Conversation
| return await Promise.all(functionInvocations); | ||
| return await Promise.all(functionInvocations); | ||
| } catch (e) { | ||
| attachFunctionNameToError(e, functionName); |
There was a problem hiding this comment.
This is the actual change. rest is indentation due to try block
| result: reshapedResult | ||
| } | ||
| } catch (e) { | ||
| attachFunctionNameToError(e, functionName); |
There was a problem hiding this comment.
This is the actual change. rest is indentation due to try block
| function attachFunctionNameToError(error: unknown, functionName: string): void { | ||
| if (error instanceof sdk.ConnectorError) { | ||
| (error as sdk.ConnectorError & { function?: string }).function = functionName; | ||
| } | ||
| } |
There was a problem hiding this comment.
This seems like a bizarre way to bypass the fact that ConnectorError does not have a function property on it. Nobody will know that exists from a types perspective.
Is there a good reason why we didn't put it in the details bag, which is designed as a place you can chuck arbitrary error annotations?
There was a problem hiding this comment.
I went for a property at the top level if possible when logged. But this is a vague/superficial decision. Let me utilize the existing detail bag for this.
There was a problem hiding this comment.
I don't think we need to bother with this PR now, this PR hasura/ndc-sdk-typescript#54 will ensure error logs will be marked with the "function name" at the NDC SDK level.
Summary
executeQueryandexecuteMutation.Changes:
Example log output:
Sec updates