mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
cd4f5e5adb
Summary: When an unconfirmed user tries to sign in or reset their password, the email verification flow is now automatically restarted. Prior to this change, an unconfirmed user error was shown in the client. Test Plan: Deployment tests. Reviewers: paulfitz, dsagal Reviewed By: dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D4133
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
/**
|
|
* A tip for fixing an error.
|
|
*/
|
|
export interface ApiTip {
|
|
action: 'add-members' | 'upgrade' | 'ask-for-help' | 'manage';
|
|
message: string;
|
|
}
|
|
|
|
export type LimitType = 'collaborators' | 'docs' | 'workspaces' | 'assistant';
|
|
|
|
/**
|
|
* Documentation of a limit relevant to an API error.
|
|
*/
|
|
export interface ApiLimit {
|
|
quantity: LimitType; // what are we counting
|
|
subquantity?: string; // a nuance to what we are counting
|
|
maximum: number; // maximum allowed
|
|
value: number; // current value of quantity for user
|
|
projectedValue: number; // value of quantity expected if request had been allowed
|
|
}
|
|
|
|
/**
|
|
* Structured details about an API error.
|
|
*/
|
|
export interface ApiErrorDetails {
|
|
code?: ApiErrorCode;
|
|
|
|
limit?: ApiLimit;
|
|
|
|
// If set, this is the more user-friendly message to show to the user than error.message.
|
|
userError?: string;
|
|
|
|
// If set, contains suggestions for fixing a problem.
|
|
tips?: ApiTip[];
|
|
|
|
memos?: string[];
|
|
}
|
|
|
|
export type ApiErrorCode =
|
|
| 'UserNotConfirmed';
|
|
|
|
/**
|
|
* An error with an http status code.
|
|
*/
|
|
export class ApiError extends Error {
|
|
constructor(message: string, public status: number, public details?: ApiErrorDetails) {
|
|
super(message);
|
|
}
|
|
}
|