-
Notifications
You must be signed in to change notification settings - Fork 77
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
front_end_error_logging #237
Changes from all commits
15dd8a5
5e61496
7ee36b6
b5e76db
3395550
4bcf6d6
b9c464b
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 |
---|---|---|
|
@@ -15,6 +15,7 @@ for both to be able to register them with the backend database. | |
Returning None for the assignment_id means that the task is being | ||
previewed by the given worker. | ||
\------------------------------------------*/ | ||
auto_submit = false | ||
|
||
// MOCK IMPLEMENTATION | ||
function getWorkerName() { | ||
|
@@ -53,3 +54,22 @@ function handleSubmitToProvider(task_data) { | |
alert("The task has been submitted! Data: " + JSON.stringify(task_data)) | ||
return true; | ||
} | ||
|
||
// Adding event listener instead of using window.onerror prevents the error to be caught twice | ||
window.addEventListener('error', function (event) { | ||
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. @pringshia is there a reason this listener is defined in 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. the first place I put it inside 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. @JackUrb - The reason for putting this in
|
||
|
||
if (event.error.hasBeenCaught !== undefined){ | ||
return false | ||
} | ||
event.error.hasBeenCaught = true | ||
if (!auto_submit) { | ||
if (confirm("Do you want to report the error?")) { | ||
prompt('send the following error to the email address: '+ | ||
'[email address]', JSON.stringify(event.error.message)) | ||
Comment on lines
+67
to
+68
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. Sorry a bit out of context here - why are we asking for an email address? 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. Pratik told me there should be a choice whether for the user to auto submit the error (wiring up 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. Understood - generally we may have a case where we want the submit to be optional but not explicitly state the contact info (for a case where people may not want to expose their actual email, but instead get contacted through the site). So really there should be three options:
Edit: I'm realizing this is attached to a specific |
||
} | ||
} | ||
else { | ||
console.log("sending to email address: ####") | ||
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. we can wire up this portion to the |
||
} | ||
return true; | ||
}) |
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.
looks good, I would make this ALL_CAPS as such and declare it as a
const