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
fix: capture error stacks across async calls #1088
Changes from 3 commits
294ac2e
541449a
aaf2c36
9da29bf
2b99046
3a4d421
5523007
d53aefb
c471b2d
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 |
---|---|---|
|
@@ -2148,6 +2148,17 @@ describe('WriteBatch class', () => { | |
}); | ||
}); | ||
|
||
it('has a full stack trace if set() errors', () => { | ||
// Use an invalid document name that the backend will reject. | ||
const ref = randomCol.doc('__doc__'); | ||
const batch = firestore.batch(); | ||
batch.set(ref, {foo: 'a'}); | ||
return batch.commit().then(() => Promise.reject('commit() should have failed') | ||
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. I am glad this is causing a lint failure :) Doesn't look pretty like this. The PR is good to go after 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. fixed. Also I changed |
||
).catch((err: Error) => { | ||
expect(err.stack).to.contain('WriteBatch.commit'); | ||
}); | ||
}); | ||
|
||
it('has update() method', () => { | ||
const ref = randomCol.doc('doc'); | ||
const batch = firestore.batch(); | ||
|
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.
Can we modify the stack in 'err' directly?
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.
good point. done.