diff --git a/src/validation/errors.ts b/src/validation/errors.ts index f6267ba51..da01aff34 100644 --- a/src/validation/errors.ts +++ b/src/validation/errors.ts @@ -5,16 +5,16 @@ import { ErrorPolykey, sysexits } from '../errors'; * Generic error containing all parsing errors that occurred during * execution. */ -class ErrorValidation extends ErrorPolykey { +class ErrorValidation extends ErrorPolykey { static description = 'Input data failed validation'; exitCode = sysexits.DATAERR; - public errors: Array>; + public errors: Array; constructor(message, data) { super(message, data); if (data.errors != null) { - const errors: Array> = []; + const errors: Array = []; for (const eData of data.errors) { - const errorParse = new ErrorParse(eData.message); + const errorParse = new ErrorParse(eData.message); errorParse.keyPath = eData.keyPath; errorParse.value = eData.value; errorParse.context = eData.context; @@ -28,7 +28,7 @@ class ErrorValidation extends ErrorPolykey { * This packages an `ErrorParse` array into the `data` property * This is to allow encoding to and decoding from GRPC errors */ - static createFromErrors(errors: Array>): ErrorValidation { + static createFromErrors(errors: Array): ErrorValidation { const message = errors.map((e) => e.message).join('; '); const data = { errors: errors.map((e) => ({ @@ -38,7 +38,7 @@ class ErrorValidation extends ErrorPolykey { context: e.context, })), }; - const e = new ErrorValidation(message, data); + const e = new ErrorValidation(message, data); e.errors = errors; return e; } @@ -51,7 +51,7 @@ class ErrorValidation extends ErrorPolykey { * While JS allows us to throw POJOs directly, having a nominal type * is easier to check against */ -class ErrorParse extends AbstractError { +class ErrorParse extends AbstractError { static description: string = 'Failed to parse data into valid format'; exitCode = sysexits.DATAERR; public keyPath: Array; diff --git a/src/validation/utils.ts b/src/validation/utils.ts index 4221e1508..3ce13f258 100644 --- a/src/validation/utils.ts +++ b/src/validation/utils.ts @@ -227,7 +227,6 @@ function parseSeedNodes(data: any): [SeedNodes, boolean] { if (e instanceof TypeError) { throw new validationErrors.ErrorParse( 'Seed nodes must be of format `nodeId@host:port;...`', - { cause: e }, ); } throw e; @@ -246,7 +245,6 @@ function parseSeedNodes(data: any): [SeedNodes, boolean] { if (e instanceof validationErrors.ErrorParse) { throw new validationErrors.ErrorParse( 'Seed nodes must be of format `nodeId@host:port;...`', - { cause: e }, ); } throw e;