summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-06-01 04:40:09 +0200
committerRory& <root@rory.gay>2025-06-01 04:40:09 +0200
commita22c00fcefa10a99505c05393106fb3a655de243 (patch)
tree417757b1e5aa9f44702ed963569e0edf6209043d /src/util
parentAdd some tests (diff)
downloadnodejs-final-assignment-a22c00fcefa10a99505c05393106fb3a655de243.tar.xz
Add register with validation
Diffstat (limited to 'src/util')
-rw-r--r--src/util/error.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/util/error.js b/src/util/error.js

index 96f1deb..5fc454a 100644 --- a/src/util/error.js +++ b/src/util/error.js
@@ -5,8 +5,9 @@ export class SafeNSoundError extends Error { this.errCode = options; super.message = this.getDefaultMessage(); } else if (typeof options === 'object') { - this.errCode = options.errCode || 'UNKNOWN_ERROR'; - super.message = options.message || this.getDefaultMessage(); + for (const key in options) { + this[key] = options[key]; + } } else { this.errCode = 'UNKNOWN_ERROR'; this.message =