pixiebrix-extension
pixiebrix-extension copied to clipboard
Review getRootCause call sites to ensure handling of non-error data
Context
-
getRootCauseandselectSpecificErrorare used to walk thecausechain to - That's relevant because we nest errors, e.g., with ContextError
- https://github.com/pixiebrix/pixiebrix-extension/pull/7681#discussion_r1499150288
-
causecan hold hold arbitrary data, not just errors: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause#providing_structured_data_as_the_error_cause - We need to double check uses of
getRootCauseandselectSpecificErrorto ensure they conceptually make sense to receive a non-error - I think we might need to introduce a version of
getRootCausethat stops once cause is not error-like - Errors are often passed around as "unknown", so we won't get type checker errors. The symptom will be that meaningful error messages might be dropped and instead a generic error message will show because the cause is not error-like