Keywork includes error utilities that pair nicely with HTTP request handlers.
import{ KeyworkResourceError, StatusCodes }from'keywork/errors' if(isLoggedIn(someUser)){ thrownewKeyworkResourceError('You must be logged in to do that', StatusCodes.UNAUTHORIZED) } if(someUser.role !=='admin'){ thrownewKeyworkResourceError('Only an admin can access that', StatusCodes.FORBIDDEN) }
Keywork includes error utilities that pair nicely with HTTP request handlers.
Related Entries
ErrorResponse