Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7188744
error-to-boom.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
618 B
Referenced Files
None
Subscribers
None
error-to-boom.ts
View Options
import
Boom
from
"boom"
;
import
type
SealiousError
from
"../response/errors.js"
;
const
error_code_map
=
{
validation
:
403
,
value_exists
:
409
,
invalid_credentials
:
401
,
not_found
:
404
,
permission
:
401
,
bad_subject
:
404
,
bad_subject_action
:
405
,
field_does_not_support_attachments
:
405
,
};
export
default
function
error_to_boom
(
error
:
SealiousError
)
{
const
code
=
error_code_map
[
error
.
type
as
keyof
typeof
error_code_map
];
const
ret
=
new
Boom
(
error
.
message
,
{
statusCode
:
code
});
// @ts-ignore;
ret
.
output
.
payload
.
type
=
error
.
type
;
// @ts-ignore;
ret
.
output
.
payload
.
data
=
error
.
data
;
return
ret
;
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Jul 8, 08:30 (13 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
632030
Default Alt Text
error-to-boom.ts (618 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment