@atproto/oauth-client
Version:
OAuth client for ATPROTO PDS. This package serves as common base for environment-specific implementations (NodeJS, Browser, React-Native).
19 lines • 686 B
JavaScript
import { ZodError } from 'zod';
export class OAuthResolverError extends Error {
constructor(message, options) {
super(message, options);
}
static from(cause, message) {
if (cause instanceof OAuthResolverError)
return cause;
const validationReason = cause instanceof ZodError
? `${cause.errors[0].path} ${cause.errors[0].message}`
: null;
const fullMessage = (message ?? `Unable to resolve identity`) +
(validationReason ? ` (${validationReason})` : '');
return new OAuthResolverError(fullMessage, {
cause,
});
}
}
//# sourceMappingURL=oauth-resolver-error.js.map