@unique-nft/api
Version:
Definitely typed JS API for the Unique Network blockchain
22 lines (18 loc) • 636 B
text/typescript
import {ISubmittableResult, SubmittableResult} from "../types";
export class ValidationError extends TypeError {
constructor(message: string) {
super(message)
this.name = 'ValidationError'
}
}
export class ExtrinsicError extends Error {
txResult: ISubmittableResult
constructor(txResult: SubmittableResult, errMessage: string, label?: string) {
if (!label) {
const info = txResult.dispatchInfo?.toHuman()
label = `transaction ${info?.section}${info?.method}`
}
super(`Transaction failed: "${errMessage}"${label ? ' for' + label : ''}.`)
this.txResult = txResult
}
}