Juice/tools.py

16 lines
280 B
Python

#!/usr/bin/env python3
"""
Miscellaneous tools and helper functions.
"""
from aiohttp import web
def make_error(code, message):
"""
Returns a JSON error.
"""
d = {'ok': False, 'status': code, 'message': message}
res = web.json_response(d)
res.set_status(code)
return res