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(
|
||||
message = null,
|
||||
code = null,
|
||||
statusCode = null
|
||||
statusCode = null,
|
||||
h
|
||||
) {
|
||||
let filteredMessage = '';
|
||||
if (code) {
|
||||
@ -65,13 +66,13 @@ export function ErrorResponse(
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
return h.response({
|
||||
message: filteredMessage
|
||||
? `${code ? code : 1000} - ${filteredMessage}`
|
||||
? `${code || 1000} - ${filteredMessage}`
|
||||
: typeof message === 'string'
|
||||
? `${code ? code : 1000} - ${message}`
|
||||
: `${code ? code : 1000} - Unexpected error`,
|
||||
code: code ? code : 1000,
|
||||
statusCode: statusCode ? statusCode : 500
|
||||
};
|
||||
? `${code || 1000} - ${message}`
|
||||
: `${code || 1000} - Unexpected error`,
|
||||
code: code || 1000,
|
||||
statusCode: statusCode || 500
|
||||
}).code(statusCode || 500);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user