mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
6af811f7ab
Summary: With this change, if a comment is added to an ACL formula, then that comment will be offered to the user if access is denied and that rule could potentially have granted access. The code is factored so that when access is permitted, or when partially visible tables are being filtered, there is little overhead. Comments are gathered only when an explicit denial of access. Test Plan: added tests, updated tests Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2730
23 lines
602 B
TypeScript
23 lines
602 B
TypeScript
import {OpenDocMode} from 'app/common/DocListAPI';
|
|
|
|
interface ErrorDetails {
|
|
status?: number;
|
|
accessMode?: OpenDocMode;
|
|
memos?: string[];
|
|
}
|
|
|
|
/**
|
|
*
|
|
* An error with a human-readable message and a machine-readable code.
|
|
* Makes it easier to change the human-readable message without breaking
|
|
* error handlers.
|
|
*
|
|
*/
|
|
export class ErrorWithCode extends Error {
|
|
constructor(public code: string, message: string, public details: ErrorDetails = {}) {
|
|
super(message);
|
|
}
|
|
public get accessMode() { return this.details?.accessMode; }
|
|
public get status() { return this.details?.status; }
|
|
}
|