fix: safer (and correct) isUnauthorizedError
This commit is contained in:
parent
71e0d82655
commit
41a0f1839f
@ -19,7 +19,12 @@ export const isUnauthorizedError = (
|
||||
error: unknown
|
||||
): error is UnauthorizedError => {
|
||||
return (
|
||||
error instanceof UnauthorizedError &&
|
||||
typeof error === 'object' &&
|
||||
error != null &&
|
||||
'data' in error &&
|
||||
typeof error.data === 'object' &&
|
||||
error.data != null &&
|
||||
'type' in error.data &&
|
||||
error.data.type === 'UnauthorizedError'
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user