Improve errors
This commit is contained in:
parent
8193b85274
commit
2a009585f4
10 changed files with 54 additions and 26 deletions
|
@ -1,5 +1,5 @@
|
|||
import jwt from "jsonwebtoken"
|
||||
import errors from "../errors"
|
||||
import { rejectionErrorFns } from "../errors"
|
||||
import jwtVerifyCatch from "../jwtVerifyCatch"
|
||||
import sendError, { API } from "./sendError"
|
||||
import type { IdToken, RawToken } from "./createTokenDB"
|
||||
|
@ -21,7 +21,7 @@ async function checkTokenIsValid(
|
|||
}
|
||||
// Making sure the token data is not a string (because it should be an object)
|
||||
if (typeof data === "string")
|
||||
return sendError(context, errors.tokenWasString(type, value))
|
||||
return sendError(context, rejectionErrorFns.tokenWasString(type, value))
|
||||
|
||||
return next({ id: data.id, type })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue