add expectedError method#6581
Conversation
da3b87c to
52460dd
Compare
| expectedError(tag, var_args) { | ||
| const error = this.error(tag, var_args); | ||
| if (error) { | ||
| error.expected = true; |
There was a problem hiding this comment.
While correct, it's a bit weird to set flag on an error after it's been reported. Maybe better refactor call into a private method and call from both methods with different flags?
There was a problem hiding this comment.
yeah i can do that, that was actually the original code i had written.
52460dd to
4bc5a5f
Compare
|
@dvoytenko changes made. PTAL |
jridgewell
left a comment
There was a problem hiding this comment.
Can we add #expectedError calls to xhr-impl.js and amp-accordion.js, too?
| * @return {!Error|undefined} | ||
| */ | ||
| error(tag, var_args) { | ||
| error_(tag, var_args) { |
src/log.js
Outdated
| const error = this.error_.apply(this, arguments); | ||
| if (error) { | ||
| error.expected = true; | ||
| this.win.setTimeout(() => {throw error;}); |
There was a problem hiding this comment.
Don't we have a rethrowAsync?
There was a problem hiding this comment.
yeah, i think it calls createErrorVarArgs again though
|
@jridgewell can you point out to me what the expectedError is in xhr? |
|
Ping. |
|
@jridgewell sorry bout that, will finish this today. got caught up in this other issue |
ac0dc33 to
5ec84cb
Compare
| xhr.open(method, url); | ||
| } else { | ||
| throw new Error('CORS is not supported'); | ||
| throw dev().createExpectedError('CORS is not supported'); |
| }; | ||
| xhr.onabort = () => { | ||
| reject(new Error('Request aborted')); | ||
| reject(user().createExpectedError('Request aborted')); |
5ec84cb to
9062274
Compare
9062274 to
a4a008e
Compare
a4a008e to
d1f3715
Compare
* add expectedError method * add private helper method and tests * add private annotation * add createExpectedError method and fix xhr-impl
* add expectedError method * add private helper method and tests * add private annotation * add createExpectedError method and fix xhr-impl
* add expectedError method * add private helper method and tests * add private annotation * add createExpectedError method and fix xhr-impl
No description provided.