Browse Source

chore: Add a comment explaning error message default (#33673)

Adding a comment to the addErrorMessage util
explaining the default value.
Shruthi 2 years ago
parent
commit
f95080e2ac
1 changed files with 4 additions and 0 deletions
  1. 4 0
      static/app/actionCreators/indicator.tsx

+ 4 - 0
static/app/actionCreators/indicator.tsx

@@ -86,6 +86,10 @@ export function addErrorMessage(msg: React.ReactNode, options?: Options) {
   if (typeof msg === 'string' || React.isValidElement(msg)) {
     return addMessageWithType('error')(msg, options);
   }
+  // When non string, non-react element responses are passed, addErrorMessage
+  // crashes the entire page because it falls outside any error
+  // boundaries defined for the components on the page. Adding a fallback
+  // to prevent page crashes.
   return addMessageWithType('error')(
     t(
       "You've hit an issue, fortunately we use Sentry to monitor Sentry. So it's likely we're already looking into this!"