Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1.4 kB · 31 lines
TypeScript
1234567891011121314151617181920212223242526272829303132export const messages = { oauth_setup_required: "Cloudflare connection is unavailable. The Flarebot publisher needs to finish OAuth setup.", oauth_capability_unavailable: "The Flarebot publisher needs to verify deployment permissions for this release.", oauth_invalid_callback: "This sign-in link is invalid or expired. Connect to Cloudflare again.", oauth_denied: "Cloudflare authorization was declined. Connect again when you are ready.", reauthorization_required: "Your Cloudflare authorization expired or was revoked. Connect again to continue.", account_denied: "This account is not available with your Cloudflare authorization. Choose another account or reconnect.", no_accounts: "No Cloudflare accounts are available with this authorization. Reconnect with access to an account.", temporarily_unavailable: "Cloudflare could not be reached. Try again shortly.", forbidden: "This request could not be verified. Return to Flarebot and try again.", invalid_request: "This request is invalid. Reload the page and try again.",} as const;export type ErrorCode = keyof typeof messages;export class OAuthError extends Error { readonly code: ErrorCode; constructor(code: ErrorCode) { super(code); this.code = code; }}export const safeCode = (error: unknown): ErrorCode => error instanceof OAuthError ? error.code : "temporarily_unavailable";