VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.89k forks source link

Error Tracking #2120

Open SachaG opened 6 years ago

SachaG commented 6 years ago

WIP: https://github.com/VulcanJS/Vulcan/tree/errors

Things to note compared to @ErikDakoda's original code:

Overall it seems to work, I've got Sentry reporting server-side and client-side errors. I still need to look into some things though, such as identifying the current user; and how to handle document not found and permission errors (differentiate them by tag? log level?).

SachaG commented 6 years ago
SachaG commented 6 years ago

TODO:

nnennajohn commented 6 years ago

@SachaG I'd love to help with this. But seems you got most of it covered. The only changes I'd make is allowing for conditionally showing the error or showing a user friendly message instead if the environment is not dev. This is especially useful since most error messages are not useful to the user. You can still log it in the console, and you are already sending it to Sentry. Also, the possibility of showing a fallback component.

The show only in dev could possible be passed as a config to settings, and also a config setting to fallback message string. Not sure.

For the ErrorCatcher HOC, its pretty trivial. In the same file as ErrorCatcher:

export const withErrorCatcher = (WrappedComponent) => {
  return function WithErrorCatcherComponent(props) {
    return (
      < ErrorCatcher >
        <WrappedComponent {...props} />
      </ErrorCatcher >
    );
  }
}

Only problem is I am not sure how to pass options to withErrorCatcher this way. So I mostly use it as a regular component when I need to pass extra options.

Def let me know If I can help anyway.

Thanks.

SachaG commented 6 years ago

I was thinking maybe we could have a "show details" link that shows you the full error or something. Not sure about making a difference between dev/non-dev as having different behaviors in different environments can often make it super hard to track down a bug.