@@ -11,6 +11,7 @@ import getTVLOfRecordClosestToTimestamp from "../../utils/shared/getRecordCloses
11
11
import { getLastRecord } from "../utils/getLastRecord" ;
12
12
import { humanizeNumber } from "@defillama/sdk/build/computeTVL/humanizeNumber" ;
13
13
import { executeAndIgnoreErrors } from "./errorDb" ;
14
+ import { sendMessage } from "../../utils/discord" ;
14
15
15
16
type PKconverted = ( id : string ) => string ;
16
17
@@ -60,9 +61,9 @@ export default async (
60
61
peggedID ,
61
62
`Circulating has 5x (${ change } ) within one hour, disabling it` ,
62
63
] ) ;
63
- throw new Error (
64
- `Circulating for ${ peggedAsset . name } has 5x ( ${ change } ) within one hour, disabling it`
65
- ) ;
64
+ const errorMessage = `Circulating for ${ peggedAsset . name } has 5x ( ${ change } ) within one hour, disabling it`
65
+ await sendMessage ( errorMessage , process . env . OUTDATED_WEBHOOK ! ) ;
66
+ throw new Error ( errorMessage ) ;
66
67
} else {
67
68
await executeAndIgnoreErrors ( "INSERT INTO `errors` VALUES (?, ?, ?)" , [
68
69
unixTimestamp ,
@@ -80,9 +81,9 @@ export default async (
80
81
currentCirculating !== 0 &&
81
82
Math . abs ( lastHourlyPeggedObject . SK - unixTimestamp ) < 12 * HOUR
82
83
) {
83
- throw new Error (
84
- `Circulating for ${ peggedAsset . name } has dropped >50% within one hour, disabling it`
85
- ) ;
84
+ const errorMessage = `Circulating for ${ peggedAsset . name } has dropped >50% within one hour, disabling it`
85
+ await sendMessage ( errorMessage , process . env . OUTDATED_WEBHOOK ! ) ;
86
+ throw new Error ( errorMessage ) ;
86
87
}
87
88
await Promise . all (
88
89
Object . entries ( peggedBalances ) . map ( async ( [ chain , issuance ] ) => {
0 commit comments