You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
606 B
22 lines
606 B
import type { Hash } from '../types/misc.js'
|
|
|
|
import { BaseError } from './base.js'
|
|
|
|
export type BlockNotFoundErrorType = BlockNotFoundError & {
|
|
name: 'BlockNotFoundError'
|
|
}
|
|
export class BlockNotFoundError extends BaseError {
|
|
constructor({
|
|
blockHash,
|
|
blockNumber,
|
|
}: {
|
|
blockHash?: Hash | undefined
|
|
blockNumber?: bigint | undefined
|
|
}) {
|
|
let identifier = 'Block'
|
|
if (blockHash) identifier = `Block at hash "${blockHash}"`
|
|
if (blockNumber) identifier = `Block at number "${blockNumber}"`
|
|
super(`${identifier} could not be found.`, { name: 'BlockNotFoundError' })
|
|
}
|
|
}
|