@atproto/oauth-client
Version:
OAuth client for ATPROTO PDS. This package serves as common base for environment-specific implementations (NodeJS, Browser, React-Native).
22 lines • 809 B
JavaScript
import { ifString } from './util.js';
export class OAuthResponseError extends Error {
constructor(response, payload) {
const error = ifString(payload?.['error']);
const errorDescription = ifString(payload?.['error_description']);
const messageError = error ? `"${error}"` : 'unknown';
const messageDesc = errorDescription ? `: ${errorDescription}` : '';
const message = `OAuth ${messageError} error${messageDesc}`;
super(message);
this.response = response;
this.payload = payload;
this.error = error;
this.errorDescription = errorDescription;
}
get status() {
return this.response.status;
}
get headers() {
return this.response.headers;
}
}
//# sourceMappingURL=oauth-response-error.js.map