@sprucelabs/error 5.1.108 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  Error.stackTraceLimit = Infinity;
4
4
  class AbstractSpruceError extends Error {
5
+ options;
6
+ originalError;
5
7
  constructor(options) {
6
8
  const { code } = options;
7
9
  super(code);
@@ -27,12 +29,14 @@ class AbstractSpruceError extends Error {
27
29
  }
28
30
  }
29
31
  this.message = this.friendlyMessage();
30
- const optionsWithoutCode = Object.assign({}, options);
32
+ const optionsWithoutCode = { ...options };
31
33
  //@ts-ignore
32
34
  delete optionsWithoutCode.code;
33
35
  delete optionsWithoutCode.originalError;
34
36
  this.stack =
35
- this.stack + '\n\nOptions: ' + JSON.stringify(optionsWithoutCode, null, 2);
37
+ this.stack +
38
+ '\n\nOptions: ' +
39
+ JSON.stringify(optionsWithoutCode, null, 2);
36
40
  }
37
41
  friendlyMessage() {
38
42
  return this.options.friendlyMessage || this.message;
@@ -41,7 +45,7 @@ class AbstractSpruceError extends Error {
41
45
  return this.toJson();
42
46
  }
43
47
  serializeOriginalError(options) {
44
- let serializedOptions = Object.assign({}, options);
48
+ let serializedOptions = { ...options };
45
49
  if (!(serializedOptions.originalError instanceof AbstractSpruceError) &&
46
50
  serializedOptions.originalError instanceof Error) {
47
51
  serializedOptions.originalError = {
@@ -59,7 +63,10 @@ class AbstractSpruceError extends Error {
59
63
  }
60
64
  toObject() {
61
65
  const obj = {
62
- options: Object.assign(Object.assign({}, this.serializeOriginalError(this.options)), { friendlyMessage: this.friendlyMessage() }),
66
+ options: {
67
+ ...this.serializeOriginalError(this.options),
68
+ friendlyMessage: this.friendlyMessage(),
69
+ },
63
70
  };
64
71
  if (this.stack) {
65
72
  obj.stack = this.stack;
@@ -30,7 +30,9 @@ export default class AbstractSpruceError extends Error {
30
30
  delete optionsWithoutCode.code;
31
31
  delete optionsWithoutCode.originalError;
32
32
  this.stack =
33
- this.stack + '\n\nOptions: ' + JSON.stringify(optionsWithoutCode, null, 2);
33
+ this.stack +
34
+ '\n\nOptions: ' +
35
+ JSON.stringify(optionsWithoutCode, null, 2);
34
36
  }
35
37
  friendlyMessage() {
36
38
  return this.options.friendlyMessage || this.message;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "5.1.108",
6
+ "version": "6.0.0",
7
7
  "skill": {
8
8
  "namespace": "spruce-error",
9
9
  "upgradeIgnoreList": [
@@ -47,8 +47,8 @@
47
47
  "clean.build": "rm -rf build/",
48
48
  "clean.dependencies": "rm -rf node_modules/ package-lock.json yarn.lock",
49
49
  "clean.dist": "rm -rf build/__tests__ build/esm/__tests__",
50
- "fix.lint": "eslint --fix --cache '**/*.ts'",
51
- "lint": "eslint --cache '**/*.ts'",
50
+ "fix.lint": "eslint --fix --cache",
51
+ "lint": "eslint --cache",
52
52
  "lint.tsc": "tsc -p . --noEmit",
53
53
  "test": "jest",
54
54
  "post.watch.build": "yarn build.copy-files",
@@ -66,18 +66,18 @@
66
66
  "watch.tsc": "tsc -w"
67
67
  },
68
68
  "devDependencies": {
69
- "@sprucelabs/esm-postbuild": "^5.0.200",
70
- "@sprucelabs/semantic-release": "^4.0.8",
71
- "@sprucelabs/test": "^8.0.50",
69
+ "@sprucelabs/esm-postbuild": "^6.0.0",
70
+ "@sprucelabs/semantic-release": "^5.0.1",
71
+ "@sprucelabs/test": "^9.0.1",
72
72
  "chokidar-cli": "^3.0.0",
73
73
  "concurrently": "^8.2.2",
74
- "eslint": "^8.57.0",
75
- "eslint-config-spruce": "^10.13.6",
74
+ "eslint": "^9.0.0",
75
+ "eslint-config-spruce": "^11.2.2",
76
76
  "jest": "^29.7.0",
77
77
  "jest-circus": "^29.7.0",
78
78
  "prettier": "^3.2.5",
79
79
  "tsc-watch": "^6.2.0",
80
- "typescript": "^5.4.4"
80
+ "typescript": "^5.4.5"
81
81
  },
82
82
  "peerDependencies": {},
83
83
  "dependencies": {},