Are you an LLM? You can read better optimized documentation at /api/@warp-drive/legacy/adapter/error/variables/UnauthorizedError.md for this page in Markdown format
module@warp-drive/legacy/adapter/error @legacyVariable UnauthorizedError
ts
UnauthorizedError: AdapterRequestErrorConstructor<UnauthorizedError>;Defined in: warp-drive-packages/legacy/src/adapter/error.ts:346
A UnauthorizedError equates to an HTTP 401 Unauthorized response status. It is used by an adapter to signal that a request to the external API was rejected because authorization is required and has failed or has not yet been provided.
An example use case would be to redirect the user to a login route if a request is unauthorized:
app/routes/application.js
js
import { UnauthorizedError } from '@warp-drive/legacy/adapter/error';
export default class ApplicationRoute extends Route {
@action
error(error, transition) {
if (error instanceof UnauthorizedError) {
// go to the login route
this.transitionTo('login');
return;
}
// ...other error handling logic
}
}