stacker.news/wallets/errors.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-10-23 17:42:34 +00:00
export class InvoiceCanceledError extends Error {
constructor (hash, actionError) {
super(actionError ?? `invoice canceled: ${hash}`)
this.name = 'InvoiceCanceledError'
this.hash = hash
this.actionError = actionError
}
}
export class InvoiceExpiredError extends Error {
constructor (hash) {
super(`invoice expired: ${hash}`)
this.name = 'InvoiceExpiredError'
}
}
2024-11-25 00:53:57 +00:00
export class WalletNotEnabledError extends Error {
constructor (name) {
super(`wallet is not enabled: ${name}`)
this.name = 'WalletNotEnabledError'
}
}
export class SenderError extends Error {
2024-11-26 02:29:28 +00:00
constructor (name, invoice, message) {
super(`${name} failed to pay invoice ${invoice.hash}: ${message}`)
2024-11-26 01:26:32 +00:00
this.name = 'SenderError'
2024-11-26 02:29:28 +00:00
this.invoice = invoice
2024-11-25 00:53:57 +00:00
}
}
export class WalletAggregateError extends AggregateError {
2024-11-26 02:29:28 +00:00
constructor (errors, newInvoice) {
2024-11-25 00:53:57 +00:00
super(errors)
this.name = 'WalletAggregateError'
2024-11-26 02:29:28 +00:00
this.newInvoice = newInvoice
2024-11-25 00:53:57 +00:00
}
}
export class NoWalletAvailableError extends Error {
constructor () {
super('no wallet for payments available')
this.name = 'NoWalletAvailableError'
}
}