request: add missing critical error
This commit is contained in:
parent
cc6345ff63
commit
dd77835599
1 changed files with 14 additions and 7 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue