Skip to content

Commit

Permalink
Add clearer err msgs when faucet is low or empty
Browse files Browse the repository at this point in the history
  • Loading branch information
harryttd committed Oct 6, 2023
1 parent bb4ff63 commit 9b7515a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Tezos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,22 @@ export const sendTezAndRespond = async (
return res
.status(200)
.send({ txHash, status: "SUCCESS", message: "Tez sent" })
} catch (err) {
console.error(`Error sending Tez to ${address}.`)
} catch (err: any) {
console.error(`Error sending Tez to ${address}.`, err)

const { message } = err

if (
message.includes("subtraction_underflow") ||
message.includes("storage_exhausted") ||
message.includes("empty_implicit_contract")
) {
return res.status(500).send({
status: "ERROR",
message: "Faucet is low or has gone empty. Please contact the team.",
})
}

throw err
}
}

0 comments on commit 9b7515a

Please sign in to comment.