feat: Implement create dynamic data API endpoint
This commit is contained in:
@@ -27,6 +27,10 @@ const authorizationList = {
|
||||
action: 'update',
|
||||
subject: 'Flow',
|
||||
},
|
||||
'POST /api/v1/steps/:stepId/dynamic-data': {
|
||||
action: 'update',
|
||||
subject: 'Flow',
|
||||
},
|
||||
'GET /api/v1/connections/:connectionId/flows': {
|
||||
action: 'read',
|
||||
subject: 'Flow',
|
||||
|
@@ -2,6 +2,7 @@ import logger from './logger.js';
|
||||
import objection from 'objection';
|
||||
import * as Sentry from './sentry.ee.js';
|
||||
const { NotFoundError, DataError } = objection;
|
||||
import HttpError from '../errors/http.js';
|
||||
|
||||
// Do not remove `next` argument as the function signature will not fit for an error handler middleware
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
@@ -18,6 +19,17 @@ const errorHandler = (error, request, response, next) => {
|
||||
response.status(400).end();
|
||||
}
|
||||
|
||||
if (error instanceof HttpError) {
|
||||
const httpErrorPayload = {
|
||||
errors: JSON.parse(error.message),
|
||||
meta: {
|
||||
type: 'HttpError',
|
||||
},
|
||||
};
|
||||
|
||||
response.status(200).json(httpErrorPayload);
|
||||
}
|
||||
|
||||
const statusCode = error.statusCode || 500;
|
||||
|
||||
logger.error(request.method + ' ' + request.url + ' ' + statusCode);
|
||||
|
Reference in New Issue
Block a user