[BUGFIX release] ensure “pause on exception” pauses in the right place#15599
Closed
stefanpenner wants to merge 1 commit intomasterfrom
Closed
[BUGFIX release] ensure “pause on exception” pauses in the right place#15599stefanpenner wants to merge 1 commit intomasterfrom
stefanpenner wants to merge 1 commit intomasterfrom
Conversation
dc120d4 to
1fc7137
Compare
rwjblue
reviewed
Aug 25, 2017
Member
rwjblue
left a comment
There was a problem hiding this comment.
I think we also need a test for this. Something like:
import {
onErrorTarget,
getDispatchOverride,
setDispatchOverride,
getOnerror,
setOnerror
} from '../error_handler';
const DISPATCH_OVERRIDE = getDispatchOverride();
const ONERROR = getOnerror();
module('error_handler', {
afterEach() {
setOnerror(ONERROR);
setDispatchOverride(DISPATCH_OVERRIDE);
}
});
test('by default there is no onerror', function(assert) {
assert.equal(onErrorTarget.onerror, undefined);
});
test('when dispatch override is registered', function(assert) {
assert.expect(2);
let override = () => assert.ok(true, 'dispatch called');
setDispatchOverride(overide);
assert.equal(onErrorTarget.onerror, override);
});
test('when onerror is registered', function(assert) {
assert.expect(2);
let override = () => assert.ok(true, 'onerror called');
setOnerror(overide);
assert.equal(onErrorTarget.onerror, override);
});|
|
||
| export const onErrorTarget = { | ||
| get onerror() { | ||
| return dispatchError || getOnerror(); |
Member
There was a problem hiding this comment.
Maybe I'm missing something, but I don't see how this works since dispatchError is always defined just below here?
I would think you want this to actually be:
export const onErrorTarget = {
get onerror() {
return getDispatchOverride() || getOnerror();
}
}1fc7137 to
2a28a8f
Compare
Member
Author
|
yup, test looks good. Adding it |
Member
|
@stefanpenner - We should consider backporting this to 2.12 LTS. Thoughts? |
It is quite common (like in ember-data’s tests) to not have a global onError handler in tests. But because of the previous state of code, we would still end up paused in the default dispatchError rather then where the actual error was thrown. This addresses the issue, but ensuring onErrorTarget.onerror returns undefined if no onError has been set
2a28a8f to
e16ffc7
Compare
Member
Author
|
There appears to be a BB issue preventing this from working correctly. |
Member
Author
|
I think -> BackburnerJS/backburner.js#262 fixes the BB issue |
Member
Author
|
ya that BB fix address this (linked locally) |
Member
Author
|
oh GH you so silly... #15600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is quite common (like in ember-data’s tests) to not have a global onError handler in tests.
But because of the previous state of code, we would still end up paused in the default dispatchError rather then where the actual error was thrown.
This addresses the issue, but ensuring onErrorTarget.onerror returns undefined if no onError has been set
before:
After: