diff --git a/src/modules/processing/request.js b/src/modules/processing/request.js index 9015e742..9b7af098 100644 --- a/src/modules/processing/request.js +++ b/src/modules/processing/request.js @@ -22,6 +22,17 @@ const apiVar = { } export function createResponse(responseType, responseData) { + const internalError = (text) => { + return { + status: 500, + body: { + status: "error", + text: text || "Internal Server Error", + critical: true + } + } + } + try { let status = 200, response = {}; @@ -72,6 +83,8 @@ export function createResponse(responseType, responseData) { audio: audio } break; + case "critical": + return internalError(responseData.t) default: throw "unreachable" } @@ -83,13 +96,7 @@ export function createResponse(responseType, responseData) { } } } catch { - return { - status: 500, - body: { - status: "error", - text: "Internal Server Error" - } - } + return internalError() } }