More elegant error handling
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
|
||||
from ..extensions import db
|
||||
|
||||
from flask import jsonify
|
||||
from wtforms.validators import ValidationError
|
||||
|
||||
import json
|
||||
@ -53,4 +54,8 @@ def get_dataset_choices():
|
||||
label = f'{label} (Default)' if dataset.default else label
|
||||
choice = (dataset.id, label)
|
||||
dataset_choices.append(choice)
|
||||
return dataset_choices
|
||||
return dataset_choices
|
||||
|
||||
def send_errors_to_client(form):
|
||||
errors = [*form.errors]
|
||||
return jsonify({ 'error': errors}), 400
|
Reference in New Issue
Block a user