From be1f19675a94c0662a446e7e9b30ac409249f1a5 Mon Sep 17 00:00:00 2001 From: wphan Date: Thu, 26 Oct 2023 08:51:28 -0700 Subject: [PATCH] clean up liquidator errors --- src/bots/liquidator.ts | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/bots/liquidator.ts b/src/bots/liquidator.ts index 5de72f72..4400d2b1 100644 --- a/src/bots/liquidator.ts +++ b/src/bots/liquidator.ts @@ -1996,24 +1996,26 @@ tx: ${tx} ` `Error liquidating auth: ${auth}, user: ${userKey} on market ${liquidateePosition.marketIndex} ` ); console.error(e); - webhookMessage( - `[${ - this.name - }]: :x: Error liquidating auth: ${auth}, user: ${userKey} on market ${ - liquidateePosition.marketIndex - } \n${e.logs ? (e.logs as Array).join('\n') : ''} \n${ - e.stack || e - } ` - ); + + const errorCode = getErrorCode(e); + if (errorCode && !errorCodesToSuppress.includes(errorCode)) { + webhookMessage( + `[${ + this.name + }]: :x: Error liquidatePerp'ing auth: ${auth}, user: ${userKey} on market ${ + liquidateePosition.marketIndex + } \n${ + e.logs ? (e.logs as Array).join('\n') : '' + } \n${e.stack || e} ` + ); + } }) .finally(() => { this.sdkCallDurationHistogram!.record(Date.now() - start, { method: 'liquidatePerp', }); }); - } - - if (liquidateeHasLpPos) { + } else if (liquidateeHasLpPos) { logger.info( `liquidatePerp ${auth}-${user.userAccountPublicKey.toBase58()} on market ${ liquidateePosition.marketIndex @@ -2037,6 +2039,18 @@ tx: ${tx} ` logger.error( `Error liquidating auth: ${auth}, user: ${userKey} on market ${liquidateePosition.marketIndex}\n${e}` ); + const errorCode = getErrorCode(e); + if (errorCode && !errorCodesToSuppress.includes(errorCode)) { + webhookMessage( + `[${ + this.name + }]: :x: Error liquidatePerp'ing auth (with no pos, but has lp shares): ${auth}, user: ${userKey} on market ${ + liquidateePosition.marketIndex + } \n${ + e.logs ? (e.logs as Array).join('\n') : '' + } \n${e.stack || e} ` + ); + } }); } }