@clerk/shared
Version:
Internal package utils used by the Clerk SDKs
88 lines • 1.98 kB
TypeScript
//#region src/types/errors.d.ts
interface ClerkAPIErrorJSON {
code: string;
message: string;
long_message?: string;
meta?: {
param_name?: string;
session_id?: string;
email_addresses?: string[];
identifiers?: string[];
zxcvbn?: {
suggestions: {
code: string;
message: string;
}[];
};
plan?: {
amount_formatted: string;
annual_monthly_amount_formatted: string;
currency_symbol: string;
id: string;
name: string;
};
is_plan_upgrade_possible?: boolean;
seats_quantity_to_add?: number;
seats_quantity?: number;
};
}
/**
* An interface that represents an error returned by the Clerk API.
*/
interface ClerkAPIError {
/**
* A string code that represents the error, such as `username_exists_code`.
*/
code: string;
/**
* A message that describes the error.
*/
message: string;
/**
* A more detailed message that describes the error.
*/
longMessage?: string;
/**
* Additional information about the error.
*/
meta?: {
paramName?: string;
sessionId?: string;
emailAddresses?: string[];
identifiers?: string[];
zxcvbn?: {
suggestions: {
code: string;
message: string;
}[];
};
permissions?: string[];
plan?: {
amount_formatted: string;
annual_monthly_amount_formatted: string;
currency_symbol: string;
id: string;
name: string;
};
isPlanUpgradePossible?: boolean;
seatsQuantityToAdd?: number;
seatsQuantity?: number;
};
}
interface ClerkRuntimeError {
code: string;
message: string;
}
/**
* Interface representing a Clerk API Response Error.
*/
interface ClerkAPIResponseError extends Error {
clerkError: true;
status: number;
message: string;
clerkTraceId?: string;
retryAfter?: number;
errors: ClerkAPIError[];
}
//#endregion
export { ClerkAPIError, ClerkAPIErrorJSON, ClerkAPIResponseError, ClerkRuntimeError };