fix: Backend crashes when invalid url is used

Improve error handling for flow info API
This commit is contained in:
Peng-YM
2022-06-29 14:07:22 +08:00
parent ffc7c07469
commit 9653b09844
7 changed files with 84 additions and 38 deletions

View File

@@ -0,0 +1,18 @@
export function success(resp, data, statusCode) {
resp.status(statusCode || 200).json({
status: 'success',
data,
});
}
export function failed(resp, error, statusCode) {
resp.status(statusCode || 500).json({
status: 'failed',
error: {
code: error.code,
type: error.type,
message: error.message,
details: error.details,
},
});
}