@visulima/error 4.5.0 → 4.6.1

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +148 -4
  3. package/dist/code-frame/index.cjs +6 -135
  4. package/dist/code-frame/index.mjs +6 -130
  5. package/dist/error/index.cjs +1 -18
  6. package/dist/error/index.d.cts +19 -1
  7. package/dist/error/index.d.mts +19 -1
  8. package/dist/error/index.d.ts +19 -1
  9. package/dist/error/index.mjs +1 -5
  10. package/dist/index.cjs +1 -36
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.mjs +1 -13
  15. package/dist/packem_shared/NonError-CQn4sdxd.cjs +1 -0
  16. package/dist/packem_shared/NonError-CS10kwil.mjs +1 -0
  17. package/dist/packem_shared/addKnownErrorConstructor-B5dNFGsR.cjs +1 -0
  18. package/dist/packem_shared/addKnownErrorConstructor-BqqnTSZp.mjs +1 -0
  19. package/dist/packem_shared/aiFinder-Be-xHFVO.mjs +1 -0
  20. package/dist/packem_shared/aiFinder-CN0pneE2.cjs +1 -0
  21. package/dist/packem_shared/aiSolutionResponse-C5apAmTu.cjs +10 -0
  22. package/dist/packem_shared/aiSolutionResponse-RD0AK1jh.mjs +10 -0
  23. package/dist/packem_shared/captureRawStackTrace-B9d1821F.cjs +1 -0
  24. package/dist/packem_shared/captureRawStackTrace-CQPNHvBG.mjs +1 -0
  25. package/dist/packem_shared/deserializeError-2C6o7QF7.cjs +1 -0
  26. package/dist/packem_shared/deserializeError-tzZhIV70.mjs +1 -0
  27. package/dist/packem_shared/errorHintFinder-C_g0nvml.mjs +2 -0
  28. package/dist/packem_shared/errorHintFinder-DRCn1Ysx.cjs +2 -0
  29. package/dist/packem_shared/formatStackFrameLine-DD2DUdW0.cjs +2 -0
  30. package/dist/packem_shared/formatStackFrameLine-iU54KA81.mjs +2 -0
  31. package/dist/packem_shared/getErrorCauses-B7_Z_gEF.cjs +1 -0
  32. package/dist/packem_shared/getErrorCauses-D025FGyO.mjs +1 -0
  33. package/dist/packem_shared/index-CLFYRLyq.mjs +1 -0
  34. package/dist/packem_shared/index-CqSGigts.cjs +1 -0
  35. package/dist/packem_shared/indexToLineColumn-B1F7aNZh.mjs +1 -0
  36. package/dist/packem_shared/indexToLineColumn-C_v57REF.cjs +1 -0
  37. package/dist/packem_shared/isVisulimaError-CrvBm0kw.cjs +1 -0
  38. package/dist/packem_shared/isVisulimaError-jVZgumOU.mjs +1 -0
  39. package/dist/packem_shared/parseStacktrace-Dnxnc4PL.mjs +2 -0
  40. package/dist/packem_shared/parseStacktrace-MW4-SLXl.cjs +2 -0
  41. package/dist/packem_shared/renderError-D7R71d_7.mjs +18 -0
  42. package/dist/packem_shared/renderError-D8XJnkIF.cjs +18 -0
  43. package/dist/packem_shared/ruleBasedFinder-DTyLJeCs.cjs +35 -0
  44. package/dist/packem_shared/ruleBasedFinder-W5UXhtHl.mjs +35 -0
  45. package/dist/packem_shared/serializeError-7S1IG6zs.cjs +1 -0
  46. package/dist/packem_shared/serializeError-Bc-QciX0.mjs +1 -0
  47. package/dist/solution/ai/ai-prompt.cjs +7 -17
  48. package/dist/solution/ai/ai-prompt.mjs +7 -15
  49. package/dist/solution/ai/index.cjs +1 -13
  50. package/dist/solution/ai/index.d.cts +2 -2
  51. package/dist/solution/ai/index.d.mts +2 -2
  52. package/dist/solution/ai/index.d.ts +2 -2
  53. package/dist/solution/ai/index.mjs +1 -3
  54. package/dist/solution/index.cjs +1 -11
  55. package/dist/solution/index.mjs +1 -2
  56. package/dist/stacktrace/index.cjs +1 -12
  57. package/dist/stacktrace/index.d.cts +2 -2
  58. package/dist/stacktrace/index.d.mts +2 -2
  59. package/dist/stacktrace/index.d.ts +2 -2
  60. package/dist/stacktrace/index.mjs +1 -2
  61. package/package.json +1 -1
  62. package/dist/packem_shared/aiFinder-BGfwKKxE.cjs +0 -263
  63. package/dist/packem_shared/aiFinder-Bk1vt0_x.mjs +0 -261
  64. package/dist/packem_shared/aiSolutionResponse-BPckbL56.cjs +0 -37
  65. package/dist/packem_shared/aiSolutionResponse-bDi4ad8f.mjs +0 -35
  66. package/dist/packem_shared/captureRawStackTrace-ClSI1tHb.cjs +0 -14
  67. package/dist/packem_shared/captureRawStackTrace-Tl3Rqkat.mjs +0 -12
  68. package/dist/packem_shared/errorHintFinder-CQy_qIK3.mjs +0 -23
  69. package/dist/packem_shared/errorHintFinder-DZugFHq0.cjs +0 -25
  70. package/dist/packem_shared/formatStackFrameLine-DcXSX--m.cjs +0 -31
  71. package/dist/packem_shared/formatStackFrameLine-DqkmKWH3.mjs +0 -26
  72. package/dist/packem_shared/getErrorCauses-CG_JRE6j.mjs +0 -24
  73. package/dist/packem_shared/getErrorCauses-miTeYJEG.cjs +0 -26
  74. package/dist/packem_shared/indexToLineColumn-DjmjeiIY.cjs +0 -56
  75. package/dist/packem_shared/indexToLineColumn-Dx91YDU1.mjs +0 -54
  76. package/dist/packem_shared/isVisulimaError-BVLWvREw.cjs +0 -45
  77. package/dist/packem_shared/isVisulimaError-H6TqEA42.mjs +0 -40
  78. package/dist/packem_shared/parseStacktrace-6pFoXW43.cjs +0 -282
  79. package/dist/packem_shared/parseStacktrace-BKGoWCwC.mjs +0 -280
  80. package/dist/packem_shared/renderError-BWpM2m6k.mjs +0 -165
  81. package/dist/packem_shared/renderError-CXZTAXig.cjs +0 -169
  82. package/dist/packem_shared/ruleBasedFinder-BYrndubA.mjs +0 -227
  83. package/dist/packem_shared/ruleBasedFinder-y_-5kbeT.cjs +0 -229
  84. package/dist/packem_shared/serializeError-CT7s0Ffk.cjs +0 -157
  85. package/dist/packem_shared/serializeError-DusTUACt.mjs +0 -153
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const between = /* @__PURE__ */ __name((start, end, text) => {
6
- const startPosition = text.indexOf(start);
7
- if (startPosition === -1) {
8
- return "";
9
- }
10
- const adjustedStartPosition = startPosition + start.length;
11
- const endPosition = text.indexOf(end, adjustedStartPosition);
12
- if (endPosition === -1) {
13
- return "";
14
- }
15
- return text.substring(adjustedStartPosition, endPosition).trim();
16
- }, "between");
17
- const aiSolutionResponse = /* @__PURE__ */ __name((rawText) => {
18
- const description = between("FIX", "ENDFIX", rawText);
19
- if (!description) {
20
- return [
21
- "No solution found.",
22
- 'Provide this response to the Maintainer of <a href="https://github.com/visulima/visulima/issues/new?assignees=&labels=s%3A+pending+triage%2Cc%3A+bug&projects=&template=bug_report.yml" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:underline inline-flex items-center text-sm">@visulima/error</a>.',
23
- `"${rawText}"`
24
- ].join("</br></br>");
25
- }
26
- const links = between("LINKS", "ENDLINKS", rawText).split("\n").map((link) => JSON.parse(link));
27
- return `${description.replaceAll(/"([^"]*)"(\s|\.)/g, "<code>$1</code> ")}
28
-
29
- ## Links
30
-
31
- ${links.map((link) => `- <a href="${link.url}" target="_blank" rel="noopener noreferrer">${link.title}</a>`).join("\n")}
32
-
33
- --------------------
34
- This solution was generated with the <a href="https://sdk.vercel.ai/" target="_blank" rel="noopener noreferrer">AI SDK</a> and may not be 100% accurate.`;
35
- }, "aiSolutionResponse");
36
-
37
- module.exports = aiSolutionResponse;
@@ -1,35 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const between = /* @__PURE__ */ __name((start, end, text) => {
4
- const startPosition = text.indexOf(start);
5
- if (startPosition === -1) {
6
- return "";
7
- }
8
- const adjustedStartPosition = startPosition + start.length;
9
- const endPosition = text.indexOf(end, adjustedStartPosition);
10
- if (endPosition === -1) {
11
- return "";
12
- }
13
- return text.substring(adjustedStartPosition, endPosition).trim();
14
- }, "between");
15
- const aiSolutionResponse = /* @__PURE__ */ __name((rawText) => {
16
- const description = between("FIX", "ENDFIX", rawText);
17
- if (!description) {
18
- return [
19
- "No solution found.",
20
- 'Provide this response to the Maintainer of <a href="https://github.com/visulima/visulima/issues/new?assignees=&labels=s%3A+pending+triage%2Cc%3A+bug&projects=&template=bug_report.yml" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:underline inline-flex items-center text-sm">@visulima/error</a>.',
21
- `"${rawText}"`
22
- ].join("</br></br>");
23
- }
24
- const links = between("LINKS", "ENDLINKS", rawText).split("\n").map((link) => JSON.parse(link));
25
- return `${description.replaceAll(/"([^"]*)"(\s|\.)/g, "<code>$1</code> ")}
26
-
27
- ## Links
28
-
29
- ${links.map((link) => `- <a href="${link.url}" target="_blank" rel="noopener noreferrer">${link.title}</a>`).join("\n")}
30
-
31
- --------------------
32
- This solution was generated with the <a href="https://sdk.vercel.ai/" target="_blank" rel="noopener noreferrer">AI SDK</a> and may not be 100% accurate.`;
33
- }, "aiSolutionResponse");
34
-
35
- export { aiSolutionResponse as default };
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const captureRawStackTrace = /* @__PURE__ */ __name(() => {
6
- if (!Error.captureStackTrace) {
7
- return void 0;
8
- }
9
- const stack = new Error();
10
- Error.captureStackTrace(stack);
11
- return stack.stack;
12
- }, "captureRawStackTrace");
13
-
14
- module.exports = captureRawStackTrace;
@@ -1,12 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const captureRawStackTrace = /* @__PURE__ */ __name(() => {
4
- if (!Error.captureStackTrace) {
5
- return void 0;
6
- }
7
- const stack = new Error();
8
- Error.captureStackTrace(stack);
9
- return stack.stack;
10
- }, "captureRawStackTrace");
11
-
12
- export { captureRawStackTrace as default };
@@ -1,23 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const errorHintFinder = {
4
- handle: /* @__PURE__ */ __name(async (error) => {
5
- if (error.hint === void 0) {
6
- return void 0;
7
- }
8
- if (typeof error.hint === "string") {
9
- return { body: error.hint };
10
- }
11
- if (typeof error.hint === "object" && typeof error.hint.body === "string") {
12
- return error.hint;
13
- }
14
- if (Array.isArray(error.hint)) {
15
- return { body: error.hint.join("\n") };
16
- }
17
- return void 0;
18
- }, "handle"),
19
- name: "errorHint",
20
- priority: 1
21
- };
22
-
23
- export { errorHintFinder as default };
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const errorHintFinder = {
6
- handle: /* @__PURE__ */ __name(async (error) => {
7
- if (error.hint === void 0) {
8
- return void 0;
9
- }
10
- if (typeof error.hint === "string") {
11
- return { body: error.hint };
12
- }
13
- if (typeof error.hint === "object" && typeof error.hint.body === "string") {
14
- return error.hint;
15
- }
16
- if (Array.isArray(error.hint)) {
17
- return { body: error.hint.join("\n") };
18
- }
19
- return void 0;
20
- }, "handle"),
21
- name: "errorHint",
22
- priority: 1
23
- };
24
-
25
- module.exports = errorHintFinder;
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- const formatStackFrameLine = /* @__PURE__ */ __name((frame) => {
8
- const method = frame.methodName && frame.methodName !== "<unknown>" ? `${frame.methodName} ` : "";
9
- const file = frame.file ?? "<unknown>";
10
- const line = frame.line ?? 0;
11
- const column = frame.column ?? 0;
12
- if (method.trim()) {
13
- return ` at ${method}(${file}:${line}:${column})`;
14
- }
15
- return ` at ${file}:${line}:${column}`;
16
- }, "formatStackFrameLine");
17
- const formatStacktrace = /* @__PURE__ */ __name((frames, options) => {
18
- const lines = [];
19
- if (options?.header && (options.header.name || options.header.message)) {
20
- const headerName = String(options.header.name || "Error");
21
- const headerMessage = String(options.header.message || "");
22
- lines.push(`${headerName}${headerMessage ? ": " : ""}${headerMessage}`);
23
- }
24
- for (const frame of frames) {
25
- lines.push(formatStackFrameLine(frame));
26
- }
27
- return lines.join("\n");
28
- }, "formatStacktrace");
29
-
30
- exports.formatStackFrameLine = formatStackFrameLine;
31
- exports.formatStacktrace = formatStacktrace;
@@ -1,26 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const formatStackFrameLine = /* @__PURE__ */ __name((frame) => {
4
- const method = frame.methodName && frame.methodName !== "<unknown>" ? `${frame.methodName} ` : "";
5
- const file = frame.file ?? "<unknown>";
6
- const line = frame.line ?? 0;
7
- const column = frame.column ?? 0;
8
- if (method.trim()) {
9
- return ` at ${method}(${file}:${line}:${column})`;
10
- }
11
- return ` at ${file}:${line}:${column}`;
12
- }, "formatStackFrameLine");
13
- const formatStacktrace = /* @__PURE__ */ __name((frames, options) => {
14
- const lines = [];
15
- if (options?.header && (options.header.name || options.header.message)) {
16
- const headerName = String(options.header.name || "Error");
17
- const headerMessage = String(options.header.message || "");
18
- lines.push(`${headerName}${headerMessage ? ": " : ""}${headerMessage}`);
19
- }
20
- for (const frame of frames) {
21
- lines.push(formatStackFrameLine(frame));
22
- }
23
- return lines.join("\n");
24
- }, "formatStacktrace");
25
-
26
- export { formatStackFrameLine, formatStacktrace };
@@ -1,24 +0,0 @@
1
- import { inspect } from 'node:util';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const getErrorCauses = /* @__PURE__ */ __name((error) => {
6
- const seen = /* @__PURE__ */ new Set();
7
- const causes = [];
8
- let currentError = error;
9
- while (currentError) {
10
- if (seen.has(currentError)) {
11
- console.error(`Circular reference detected in error causes: ${inspect(error)}`);
12
- break;
13
- }
14
- causes.push(currentError);
15
- seen.add(currentError);
16
- if (!currentError.cause) {
17
- break;
18
- }
19
- currentError = currentError.cause;
20
- }
21
- return causes;
22
- }, "getErrorCauses");
23
-
24
- export { getErrorCauses as default };
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- const node_util = require('node:util');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- const getErrorCauses = /* @__PURE__ */ __name((error) => {
8
- const seen = /* @__PURE__ */ new Set();
9
- const causes = [];
10
- let currentError = error;
11
- while (currentError) {
12
- if (seen.has(currentError)) {
13
- console.error(`Circular reference detected in error causes: ${node_util.inspect(error)}`);
14
- break;
15
- }
16
- causes.push(currentError);
17
- seen.add(currentError);
18
- if (!currentError.cause) {
19
- break;
20
- }
21
- currentError = currentError.cause;
22
- }
23
- return causes;
24
- }, "getErrorCauses");
25
-
26
- module.exports = getErrorCauses;
@@ -1,56 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const binarySearch = /* @__PURE__ */ __name((element, array) => {
6
- let m = 0;
7
- let n = array.length - 2;
8
- while (m < n) {
9
- const key = m + (n - m >> 1);
10
- if (element < array[key]) {
11
- n = key - 1;
12
- } else if (element >= array[key + 1]) {
13
- m = key + 1;
14
- } else {
15
- m = key;
16
- break;
17
- }
18
- }
19
- return m;
20
- }, "binarySearch");
21
- const getLineStartIndexes = /* @__PURE__ */ __name((string_) => (
22
- // eslint-disable-next-line unicorn/no-array-reduce
23
- string_.split(/\n|\r(?!\n)/).reduce(
24
- (accumulator, current) => {
25
- accumulator.push(accumulator.at(-1) + current.length + 1);
26
- return accumulator;
27
- },
28
- [0]
29
- )
30
- ), "getLineStartIndexes");
31
- const indexToLineColumn = /* @__PURE__ */ __name((input, index, options) => {
32
- const skipChecks = options?.skipChecks ?? false;
33
- if (!skipChecks && (!Array.isArray(input) && typeof input !== "string" || (typeof input === "string" || Array.isArray(input)) && input.length === 0)) {
34
- return { column: 0, line: 0 };
35
- }
36
- if (!skipChecks && (typeof index !== "number" || typeof input === "string" && index >= input.length || Array.isArray(input) && index + 1 >= input.at(-1))) {
37
- return { column: 0, line: 0 };
38
- }
39
- if (typeof input === "string") {
40
- const startIndexesOfEachLine = getLineStartIndexes(input);
41
- const line2 = binarySearch(index, startIndexesOfEachLine);
42
- return {
43
- // eslint-disable-next-line security/detect-object-injection
44
- column: index - startIndexesOfEachLine[line2] + 1,
45
- line: line2 + 1
46
- };
47
- }
48
- const line = binarySearch(index, input);
49
- return {
50
- // eslint-disable-next-line security/detect-object-injection
51
- column: index - input[line] + 1,
52
- line: line + 1
53
- };
54
- }, "indexToLineColumn");
55
-
56
- module.exports = indexToLineColumn;
@@ -1,54 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const binarySearch = /* @__PURE__ */ __name((element, array) => {
4
- let m = 0;
5
- let n = array.length - 2;
6
- while (m < n) {
7
- const key = m + (n - m >> 1);
8
- if (element < array[key]) {
9
- n = key - 1;
10
- } else if (element >= array[key + 1]) {
11
- m = key + 1;
12
- } else {
13
- m = key;
14
- break;
15
- }
16
- }
17
- return m;
18
- }, "binarySearch");
19
- const getLineStartIndexes = /* @__PURE__ */ __name((string_) => (
20
- // eslint-disable-next-line unicorn/no-array-reduce
21
- string_.split(/\n|\r(?!\n)/).reduce(
22
- (accumulator, current) => {
23
- accumulator.push(accumulator.at(-1) + current.length + 1);
24
- return accumulator;
25
- },
26
- [0]
27
- )
28
- ), "getLineStartIndexes");
29
- const indexToLineColumn = /* @__PURE__ */ __name((input, index, options) => {
30
- const skipChecks = options?.skipChecks ?? false;
31
- if (!skipChecks && (!Array.isArray(input) && typeof input !== "string" || (typeof input === "string" || Array.isArray(input)) && input.length === 0)) {
32
- return { column: 0, line: 0 };
33
- }
34
- if (!skipChecks && (typeof index !== "number" || typeof input === "string" && index >= input.length || Array.isArray(input) && index + 1 >= input.at(-1))) {
35
- return { column: 0, line: 0 };
36
- }
37
- if (typeof input === "string") {
38
- const startIndexesOfEachLine = getLineStartIndexes(input);
39
- const line2 = binarySearch(index, startIndexesOfEachLine);
40
- return {
41
- // eslint-disable-next-line security/detect-object-injection
42
- column: index - startIndexesOfEachLine[line2] + 1,
43
- line: line2 + 1
44
- };
45
- }
46
- const line = binarySearch(index, input);
47
- return {
48
- // eslint-disable-next-line security/detect-object-injection
49
- column: index - input[line] + 1,
50
- line: line + 1
51
- };
52
- }, "indexToLineColumn");
53
-
54
- export { indexToLineColumn as default };
@@ -1,45 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- const isVisulimaError = /* @__PURE__ */ __name((error) => error instanceof Error && error.type === "VisulimaError", "isVisulimaError");
8
- class VisulimaError extends Error {
9
- static {
10
- __name(this, "VisulimaError");
11
- }
12
- loc;
13
- title;
14
- /**
15
- * A message that explains to the user how they can fix the error.
16
- */
17
- hint;
18
- type = "VisulimaError";
19
- constructor({ cause, hint, location, message, name, stack, title }) {
20
- super(message, {
21
- cause
22
- });
23
- this.title = title;
24
- this.name = name;
25
- this.stack = stack ?? this.stack;
26
- this.loc = location;
27
- this.hint = hint;
28
- Error.captureStackTrace(this, this.constructor);
29
- }
30
- setLocation(location) {
31
- this.loc = location;
32
- }
33
- setName(name) {
34
- this.name = name;
35
- }
36
- setMessage(message) {
37
- this.message = message;
38
- }
39
- setHint(hint) {
40
- this.hint = hint;
41
- }
42
- }
43
-
44
- exports.VisulimaError = VisulimaError;
45
- exports.isVisulimaError = isVisulimaError;
@@ -1,40 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const isVisulimaError = /* @__PURE__ */ __name((error) => error instanceof Error && error.type === "VisulimaError", "isVisulimaError");
4
- class VisulimaError extends Error {
5
- static {
6
- __name(this, "VisulimaError");
7
- }
8
- loc;
9
- title;
10
- /**
11
- * A message that explains to the user how they can fix the error.
12
- */
13
- hint;
14
- type = "VisulimaError";
15
- constructor({ cause, hint, location, message, name, stack, title }) {
16
- super(message, {
17
- cause
18
- });
19
- this.title = title;
20
- this.name = name;
21
- this.stack = stack ?? this.stack;
22
- this.loc = location;
23
- this.hint = hint;
24
- Error.captureStackTrace(this, this.constructor);
25
- }
26
- setLocation(location) {
27
- this.loc = location;
28
- }
29
- setName(name) {
30
- this.name = name;
31
- }
32
- setMessage(message) {
33
- this.message = message;
34
- }
35
- setHint(hint) {
36
- this.hint = hint;
37
- }
38
- }
39
-
40
- export { VisulimaError, isVisulimaError };