Fixup combined error#874
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
802d3df to
bca3bec
Compare
| if (response.error.networkError?.message) { | ||
| response.error.message = `[Network] ${response.error.networkError.message}`; | ||
| } else { | ||
| response.error.message = `[Network] No message, stack: ${String(response.error.networkError.stack)}`; |
There was a problem hiding this comment.
I think we should stringify the whole error error here instead of relying on just the stack. In JS you can throw anything, like throw "foo", so the error may not have a message or a stack and just be a string. Since we dont exactly know what it is I think it might be wise to be defensive and just stringify the result right out
There was a problem hiding this comment.
Ah kk, my test was just returning Error with no stack when I did string(response.networkError) which is why I explicitly grabbed the stack. Would something like
[Network] No message, error: string(response.error.networkError) \nstack: ${String(response.error.networkError.stack)} work?
| { | ||
| operation: null as any, | ||
| data: null, | ||
| error: new CombinedError({ networkError: [new Error("foo"), new Error("foo")] as any }), |
There was a problem hiding this comment.
hm this almost seems on purpose
There was a problem hiding this comment.
Yeah, that's why I wasn't sure. Based on the types it can't be an array but we're pretty adamant about that. It does not seem like an array of network errors is possible
bca3bec to
4f149b7
Compare
|
Updated, good to merge on 🍏 ? |
4f149b7 to
122a5cc
Compare
122a5cc to
55e5da1
Compare
Small change to how we format a combined error to iterate through the GrahpQL errors and append the network error.
Changelog
[no-changelog-required]