-
Notifications
You must be signed in to change notification settings - Fork 114
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 more logs and error boundaries in Label and Dashboard #1100
🪵 Add more logs and error boundaries in Label and Dashboard #1100
Conversation
This may help with debugging e-mission/e-mission-docs#986 (comment)
-added several try/catches to cover all top-level calls -added logDebug statements throughout, using `` for multi-line so they are not ugly -replaced any uses of the old Logger service
When metrics are fetched and stored as state, we can have more log statements and a try/catch.
label: withErrorBoundary(LabelTab), | ||
metrics: withErrorBoundary(MetricsTab), | ||
control: withErrorBoundary(ProfileSettings), |
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.
very cool!
if (mode == 'append') { | ||
setTimelineMap(new Map([...timelineMap, ...readTimelineMap])); | ||
} else if (mode == 'prepend') { | ||
setTimelineMap(new Map([...readTimelineMap, ...timelineMap])); | ||
} else if (mode == 'replace') { | ||
setTimelineMap(readTimelineMap); | ||
} else { | ||
return console.error('Unknown insertion mode ' + mode); | ||
return displayErrorMsg('Unknown insertion mode ' + mode); |
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.
nit: as I was looking through the logger code, I noticed that displayError
displays the full stacktrace, but displayErrorMsg
does not. Is there a reason why we would not want to include the backtrace?
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.
@JGreenlee I'm moving this to the "cleanup" column after the merge so that we can revisit how the logger should display errors.
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.
displayError
accepts an Error object as a parameter. displayErrorMsg
is used when there is no error and we just want to popup with some text.
Maybe in cases where there is no error, we should be throwing one ourselves and then print out that stacktrace?
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.
Maybe in cases where there is no error, we should be throwing one ourselves and then print out that stacktrace?
If we can do so easily, I think that would be helpful. Otherwise, we have to work backwards from the message to the code, and don't really have the full trace
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.
The stack traces are not very useful anyway because all the JS is bundled.
Maybe we could do something like https://stackoverflow.com/questions/58448000/how-to-get-a-readable-stack-trace-for-a-webpack-production-environment-for-a-min
In effort to more effectively debug e-mission/e-mission-docs#1025 and e-mission/e-mission-docs#986 (comment):
logDebug
statements throughout with nicer formattingtry
/catch
blocks, handled withdisplayError
ErrorBoundary
. This means if one of them has an error on rendering (ie an error in the JSX / the React component itself, not one of our JS functions), that tab will be blank but the other tabs will not be affected.