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
added error handling override function #181
Conversation
Verified that @sinkingrowboats has signed the CLA. Thanks for the pull request! |
@j3tan I'm assuming that this is going to fail due to the eslint rule |
@j3tan Could you review? I suspect you'll want us to change this approach in favor of one that doesn't do function reassignment how it was approached here. |
* @returns {void} | ||
*/ | ||
setErrorHandler: function(exceptionHandler) { | ||
error = exceptionHandler; |
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.
Here's the approach I would take:
Create a variable at the top of this file, next to initialized = false;
var customErrorHandler;
then you could do:
customErrorHandler = exceptionHandler;
then do:
function error(exception) {
if (customErrorHandler) {
customErrorHandler(exception);
return;
}
if (globalConfig.debug) ...
}
This will maintain the integrity of Box.Application while still giving you a handle/callback
Failing due to test coverage, I'll add those sometime today. |
Code looks good. You can even be safer and do the following:
|
please include tests, then we can merge this in! |
Added a test. Didn't really stress test all of the use cases, though I can if you want. We should also probably add some extra documentation around this. |
Last request: please link to issue ticket # in commit description |
On every commit? Or do you want us to squash and have one commit with the ticket number in it? |
Squash is preferable, helps with commit history |
@j3tan I squashed everything. Could you give it one last look over? Thanks! |
No description provided.