mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 20:58:28 +00:00
Adding a new script that script tasks can use to add in data about the study. Moving all the test workflow specifications out of the main load. fixing a pile of tests so they can find workflow specs that are now moved into the test directory.
21 lines
485 B
Python
21 lines
485 B
Python
from crc import ma, app
|
|
|
|
|
|
class ApiError(Exception):
|
|
def __init__(self, code, message, status_code=400):
|
|
self.status_code = status_code
|
|
self.code = code
|
|
self.message = message
|
|
Exception.__init__(self, self.message)
|
|
|
|
|
|
class ApiErrorSchema(ma.Schema):
|
|
class Meta:
|
|
fields = ("code", "message")
|
|
|
|
|
|
@app.errorhandler(ApiError)
|
|
def handle_invalid_usage(error):
|
|
response = ApiErrorSchema().dump(error)
|
|
return response, error.status_code
|