mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
10 lines
318 B
TypeScript
10 lines
318 B
TypeScript
export default function getErrorStatusCode(error: Error | undefined): number | undefined {
|
|
return (
|
|
error && 'cause' in error &&
|
|
typeof error.cause === 'object' && error.cause !== null &&
|
|
'status' in error.cause && typeof error.cause.status === 'number' &&
|
|
error.cause.status
|
|
) ||
|
|
undefined;
|
|
}
|