mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-07 10:18:57 +00:00
Fix missing status code for ErrorResponse
This commit is contained in:
parent
64c32b326d
commit
352d06e10f
@ -28,7 +28,8 @@
|
|||||||
export function ErrorResponse(
|
export function ErrorResponse(
|
||||||
message = null,
|
message = null,
|
||||||
code = null,
|
code = null,
|
||||||
statusCode = null
|
statusCode = null,
|
||||||
|
h
|
||||||
) {
|
) {
|
||||||
let filteredMessage = '';
|
let filteredMessage = '';
|
||||||
if (code) {
|
if (code) {
|
||||||
@ -65,13 +66,13 @@ export function ErrorResponse(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return h.response({
|
||||||
message: filteredMessage
|
message: filteredMessage
|
||||||
? `${code ? code : 1000} - ${filteredMessage}`
|
? `${code || 1000} - ${filteredMessage}`
|
||||||
: typeof message === 'string'
|
: typeof message === 'string'
|
||||||
? `${code ? code : 1000} - ${message}`
|
? `${code || 1000} - ${message}`
|
||||||
: `${code ? code : 1000} - Unexpected error`,
|
: `${code || 1000} - Unexpected error`,
|
||||||
code: code ? code : 1000,
|
code: code || 1000,
|
||||||
statusCode: statusCode ? statusCode : 500
|
statusCode: statusCode || 500
|
||||||
};
|
}).code(statusCode || 500);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user