From f78b96650617cacc7fa4131bf109edbd4c3e148a Mon Sep 17 00:00:00 2001 From: Milly Date: Tue, 30 Jul 2024 02:54:44 +0900 Subject: [PATCH] :muscle: define `name` on prototype It is recommended that the `name` property be defined as a string on the prototype. --- errors.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/errors.ts b/errors.ts index 611cbcf..b405b7f 100644 --- a/errors.ts +++ b/errors.ts @@ -10,6 +10,10 @@ * Batch error raised when one of the functions fails during batch process. */ export class BatchError extends Error { + static { + this.prototype.name = "BatchError"; + } + /** * A result list that is successfully completed prior to the error. */ @@ -18,7 +22,6 @@ export class BatchError extends Error { constructor(message: string, results: unknown[]) { super(message); - this.name = this.constructor.name; this.results = results; } }