From 92f93d97ffcb096bf7ca0e0fa871b79809f451c7 Mon Sep 17 00:00:00 2001 From: Holger Drewes Date: Fri, 27 May 2022 09:18:48 +0200 Subject: [PATCH] Block: allow sub class error to take on the type shapes of the generic error by unionizing the types --- packages/block/src/errors.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/block/src/errors.ts b/packages/block/src/errors.ts index 7b0001cec6..7a387d7234 100644 --- a/packages/block/src/errors.ts +++ b/packages/block/src/errors.ts @@ -1,4 +1,4 @@ -import { UsageError, ValidationError } from 'ethereumjs-util' +import { UsageError, ValidationError, ValidationErrorType } from 'ethereumjs-util' /** * Always define error codes on the generic Util @@ -12,10 +12,12 @@ export enum ValidationErrorCode { * Additional types extending the generic Util * error types (e.g. `ValidationErrorType`) */ -export type HeaderValidationErrorType = { - block: string - received: string -} +export type HeaderValidationErrorType = + | { + block: string + received: string + } + | ValidationErrorType export type HeaderUsageErrorType = { block: string }