UNPKG

opstack-kit-chains

Version:
23 lines (20 loc) 635 B
import type { Hash } from '../types/misc.js' import { BaseError } from './base.js' export type BlockNotFoundErrorType = BlockNotFoundError & { name: 'BlockNotFoundError' } export class BlockNotFoundError extends BaseError { override name = 'BlockNotFoundError' 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.`) } }