gristlabs_grist-core/app/common/ApiError.ts
George Gevoian 6cb8614017 (core) Polish forms
Summary:
  - Updates styling of form submitted page.
  - Tweaks styling of checkboxes, labels, and questions on form page.
  - Adds new form 404 page.
  - Adds checkbox to not show warning again when publishing or un-publishing a form.
  - Excludes formula, hidden, and attachment columns in submitted form data.
  - Adds placeholder text to form configuration inputs.
  - Improves dark mode styling in Form widget.
  - Updates default title and description of new forms.
  - Updates styling of Form widget buttons.
  - Fixes form success text input handling.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4170
2024-01-24 02:18:03 -08:00

51 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'
| 'FormNotFound';
/**
* An error with an http status code.
*/
export class ApiError extends Error {
constructor(message: string, public status: number, public details?: ApiErrorDetails) {
super(message);
}
}