Skip to content

Commit

Permalink
Merge pull request paraswap#257 from paraswap/fix/826-curve-zero-divi…
Browse files Browse the repository at this point in the history
…sion

BACK-826: Caught zero division errors for CurveV1Factory
  • Loading branch information
Verisana authored Dec 9, 2022
2 parents 6543f0f + 08e63d3 commit c6bf0d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paraswap/dex-lib",
"version": "2.9.25",
"version": "2.9.26",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down
8 changes: 8 additions & 0 deletions src/dex/curve-v1-factory/price-handlers/price-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ export class PriceHandler {
e.message.startsWith(CONVERGENCE_ERROR_PREFIX)
) {
this.logger.trace(`Convergence Error: `, e);
} else if (
e instanceof Error &&
e.message.startsWith(`Division by zero`)
) {
this.logger.trace(
`Zero division Error suppressed because mostly it is expected`,
e,
);
} else {
this.logger.error(`Unexpected error while calculating price: `, e);
}
Expand Down

0 comments on commit c6bf0d9

Please sign in to comment.