-
Notifications
You must be signed in to change notification settings - Fork 1
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
debug: increase logs of simulateBundle endpoint #105
debug: increase logs of simulateBundle endpoint #105
Conversation
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.
I would also add some error handling in the repository. Handle and retrow logic.
At minimum we can log the payload and relevant response HTTP parameters
https://github.com/cowprotocol/bff/blob/main/libs/repositories/src/SimulationRepository/SimulationRepositoryTenderly.ts#L36
Alternativelly, and probably better, is to model some Error (ApiCallError) that incorporates all the relevant data we want to handle, and then the controllers handles and logs this error properly. This approach is nicer cause you don't marry to the specific logging methon, and then other similar repositories can do the same
); | ||
|
||
if (simulationResult === null) { | ||
reply.code(400).send({ message: 'Build simulation error' }); |
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.
This was here before, but what does null
mean, and why is a 400
is an issue from the user?
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.
It means that the Tenderly couldn't simulate the transaction. This happens often on the "build your own hook" where the user manually encodes the tx data.
We used a general 400 error but maybe we could change it to 422.
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.
Thanks!
formatters: { | ||
level: (label) => ({ level: label }), | ||
}, | ||
}); |
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.
@yvesfracari why do we add the log config here, shouldn't we use the same one as https://github.com/cowprotocol/bff/blob/main/apps/api/src/main.ts#L5 ?
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.
I address it, cause I want to deploy a new release of bff with some fixes for the logging and I want to fix this small detail. Let me know if it makes sense #107
No description provided.