-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add warning to widgets when column is missing #427
Changes from all commits
70f9d28
d131060
f5b6c9b
57db12d
65d5ba4
ae8b092
e2e44c5
d9868f5
d9f50bc
e6b6ae8
1562ce2
86471ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const NAME = 'InvalidColumnError'; | ||
const ERR_START_MESSAGE = `${NAME}: `; | ||
|
||
export class InvalidColumnError extends Error { | ||
constructor(message) { | ||
super(`${ERR_START_MESSAGE}${message}`); | ||
this.name = NAME; | ||
} | ||
|
||
static is(error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know. This whole mechanism of detecting type of exception by details of how react-workers pass errors seems fishy. First of all, this is not "general" check for It would be really better to have error codes, and proper error propagation between workers and main thread. Anyway, i. am worried that all errors throws by "remote" api calls don't have "Uncaught: InvalidColumnError" prefix and thus don't pass this test ... and as result don't trigger warning. |
||
return ( | ||
error instanceof InvalidColumnError || error.message?.includes(ERR_START_MESSAGE) | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My proposition would be to change this to
and in is just test for existence of
'ERR_INVALID_COLUMN: '
in error message.This is still string test, but at least based on something that looks like error code and is universal and doesn't depend on particular details like adding "Uncaught..." by particular runtime.