@lowdefy/errors 0.0.0-experimental-20260204091424 → 0.0.0-experimental-20260204101136
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.
- package/dist/ConfigError.js +6 -2
- package/dist/ConfigWarning.js +6 -1
- package/dist/LowdefyError.js +9 -1
- package/dist/PluginError.js +15 -4
- package/dist/ServiceError.js +5 -1
- package/dist/UserError.js +28 -0
- package/dist/build/ConfigError.js +5 -6
- package/dist/build/ConfigMessage.js +12 -11
- package/dist/build/ConfigWarning.js +10 -3
- package/dist/build/resolveConfigLocation.js +6 -8
- package/dist/client/LowdefyError.js +55 -0
- package/dist/client/index.js +3 -2
- package/dist/formatErrorMessage.js +31 -0
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/ConfigError.js
CHANGED
|
@@ -31,7 +31,11 @@
|
|
|
31
31
|
* configKey: block['~k'],
|
|
32
32
|
* location: { source: 'pages/home.yaml:42', link: '/path/to/pages/home.yaml:42' }
|
|
33
33
|
* });
|
|
34
|
-
*/
|
|
34
|
+
*/ import formatErrorMessage from './formatErrorMessage.js';
|
|
35
|
+
let ConfigError = class ConfigError extends Error {
|
|
36
|
+
print() {
|
|
37
|
+
return formatErrorMessage(this);
|
|
38
|
+
}
|
|
35
39
|
/**
|
|
36
40
|
* Serializes the error for transport (e.g., client to server).
|
|
37
41
|
* @returns {Object} Serialized error data with type marker
|
|
@@ -68,7 +72,7 @@
|
|
|
68
72
|
const configKey = isString ? null : messageOrParams.configKey ?? error?.configKey;
|
|
69
73
|
const location = isString ? null : messageOrParams.location;
|
|
70
74
|
const checkSlug = isString ? undefined : messageOrParams.checkSlug;
|
|
71
|
-
const received = isString ? undefined : messageOrParams.received;
|
|
75
|
+
const received = isString ? undefined : messageOrParams.received !== undefined ? messageOrParams.received : error?.received;
|
|
72
76
|
const operatorLocation = isString ? null : messageOrParams.operatorLocation;
|
|
73
77
|
// Message without prefix - logger uses error.name for display
|
|
74
78
|
super(message);
|
package/dist/ConfigWarning.js
CHANGED
|
@@ -23,12 +23,17 @@
|
|
|
23
23
|
* @example
|
|
24
24
|
* const warning = new ConfigWarning({ message: 'Deprecated feature used', source: 'config.yaml:10' });
|
|
25
25
|
* console.warn(warning.message);
|
|
26
|
-
*/
|
|
26
|
+
*/ import formatErrorMessage from './formatErrorMessage.js';
|
|
27
|
+
let ConfigWarning = class ConfigWarning {
|
|
28
|
+
print() {
|
|
29
|
+
return formatErrorMessage(this);
|
|
30
|
+
}
|
|
27
31
|
/**
|
|
28
32
|
* @param {Object} params
|
|
29
33
|
* @param {string} params.message - The warning message
|
|
30
34
|
* @param {string} [params.source] - Source file:line
|
|
31
35
|
*/ constructor({ message, source }){
|
|
36
|
+
this.name = 'Config Warning';
|
|
32
37
|
// Message without prefix - logger uses class name for display
|
|
33
38
|
this.message = message;
|
|
34
39
|
this.source = source ?? null;
|
package/dist/LowdefyError.js
CHANGED
|
@@ -28,7 +28,15 @@
|
|
|
28
28
|
* console.error(err.message);
|
|
29
29
|
* console.error(err.stack);
|
|
30
30
|
* }
|
|
31
|
-
*/
|
|
31
|
+
*/ import formatErrorMessage from './formatErrorMessage.js';
|
|
32
|
+
let LowdefyError = class LowdefyError extends Error {
|
|
33
|
+
print() {
|
|
34
|
+
const message = formatErrorMessage(this);
|
|
35
|
+
if (this.stack) {
|
|
36
|
+
return `${message}\n${this.stack}`;
|
|
37
|
+
}
|
|
38
|
+
return message;
|
|
39
|
+
}
|
|
32
40
|
/**
|
|
33
41
|
* Serializes the error for transport (e.g., client to server).
|
|
34
42
|
* @returns {Object} Serialized error data with type marker
|
package/dist/PluginError.js
CHANGED
|
@@ -35,7 +35,11 @@
|
|
|
35
35
|
* });
|
|
36
36
|
* }
|
|
37
37
|
* // error.message = "[Plugin Error] _if requires boolean test. Received: {...} at blocks.0.properties.visible."
|
|
38
|
-
*/
|
|
38
|
+
*/ import formatErrorMessage from './formatErrorMessage.js';
|
|
39
|
+
let PluginError = class PluginError extends Error {
|
|
40
|
+
print() {
|
|
41
|
+
return formatErrorMessage(this);
|
|
42
|
+
}
|
|
39
43
|
/**
|
|
40
44
|
* Serializes the error for transport (e.g., client to server).
|
|
41
45
|
* @returns {Object} Serialized error data with type marker
|
|
@@ -43,6 +47,7 @@
|
|
|
43
47
|
return {
|
|
44
48
|
'~err': 'PluginError',
|
|
45
49
|
message: this.message,
|
|
50
|
+
rawMessage: this.rawMessage,
|
|
46
51
|
pluginType: this.pluginType,
|
|
47
52
|
pluginName: this.pluginName,
|
|
48
53
|
location: this.location,
|
|
@@ -57,14 +62,20 @@
|
|
|
57
62
|
* @param {Object} data - Serialized error data
|
|
58
63
|
* @returns {PluginError}
|
|
59
64
|
*/ static deserialize(data) {
|
|
65
|
+
// Use rawMessage if available, fallback to message
|
|
66
|
+
const messageToUse = data.rawMessage || data.message;
|
|
60
67
|
const error = new PluginError({
|
|
61
|
-
|
|
68
|
+
message: messageToUse,
|
|
62
69
|
pluginType: data.pluginType,
|
|
63
70
|
pluginName: data.pluginName,
|
|
64
71
|
configKey: data.configKey
|
|
65
72
|
});
|
|
66
73
|
// Set location separately to preserve it without re-formatting message
|
|
67
74
|
error.location = data.location;
|
|
75
|
+
// Preserve the formatted message if different from rawMessage
|
|
76
|
+
if (data.message && data.message !== messageToUse) {
|
|
77
|
+
error.message = data.message;
|
|
78
|
+
}
|
|
68
79
|
if (data.stack) {
|
|
69
80
|
error.stack = data.stack;
|
|
70
81
|
}
|
|
@@ -85,7 +96,7 @@
|
|
|
85
96
|
const rawMessage = message ?? error?.message;
|
|
86
97
|
let formattedMessage = rawMessage;
|
|
87
98
|
if (location) {
|
|
88
|
-
formattedMessage
|
|
99
|
+
formattedMessage = rawMessage != null ? `${rawMessage} at ${location}.` : `at ${location}.`;
|
|
89
100
|
}
|
|
90
101
|
super(formattedMessage, {
|
|
91
102
|
cause: error
|
|
@@ -94,7 +105,7 @@
|
|
|
94
105
|
this.pluginType = pluginType;
|
|
95
106
|
this.pluginName = pluginName;
|
|
96
107
|
this.rawMessage = rawMessage; // Original message without location
|
|
97
|
-
this.received = received;
|
|
108
|
+
this.received = received !== undefined ? received : error?.received;
|
|
98
109
|
this.location = location;
|
|
99
110
|
this.configKey = error?.configKey ?? configKey ?? null;
|
|
100
111
|
// Location info (set by server-side resolution)
|
package/dist/ServiceError.js
CHANGED
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
* throw new PluginError({ error, ... });
|
|
49
49
|
* }
|
|
50
50
|
* // error.message = "[Service Error] MongoDB: Connection refused. The service may be down..."
|
|
51
|
-
*/
|
|
51
|
+
*/ import formatErrorMessage from './formatErrorMessage.js';
|
|
52
|
+
let ServiceError = class ServiceError extends Error {
|
|
52
53
|
/**
|
|
53
54
|
* Checks if an error is a service error (network issues, timeouts, 5xx).
|
|
54
55
|
* @param {Error} error - The error to check
|
|
@@ -95,6 +96,9 @@
|
|
|
95
96
|
}
|
|
96
97
|
return error.message;
|
|
97
98
|
}
|
|
99
|
+
print() {
|
|
100
|
+
return formatErrorMessage(this);
|
|
101
|
+
}
|
|
98
102
|
/**
|
|
99
103
|
* Serializes the error for transport (e.g., client to server).
|
|
100
104
|
* @returns {Object} Serialized error data with type marker
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import formatErrorMessage from './formatErrorMessage.js';
|
|
16
|
+
let UserError = class UserError extends Error {
|
|
17
|
+
print() {
|
|
18
|
+
return formatErrorMessage(this);
|
|
19
|
+
}
|
|
20
|
+
constructor(message, { blockId, metaData, pageId } = {}){
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'UserError';
|
|
23
|
+
this.blockId = blockId;
|
|
24
|
+
this.metaData = metaData;
|
|
25
|
+
this.pageId = pageId;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export default UserError;
|
|
@@ -84,23 +84,22 @@ import ConfigMessage from './ConfigMessage.js';
|
|
|
84
84
|
this.resolved = true;
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
// Resolve location based on available info
|
|
87
|
+
// Resolve location based on available info, falling through if a method returns null
|
|
88
88
|
let location = null;
|
|
89
89
|
const configDir = configDirectory ?? context?.directories?.config;
|
|
90
90
|
if (configKey && context?.keyMap) {
|
|
91
|
-
// Mode 1: Use configKey -> keyMap -> refMap path (standard case after addKeys)
|
|
92
91
|
location = ConfigMessage.resolveLocation({
|
|
93
92
|
configKey,
|
|
94
93
|
context
|
|
95
94
|
});
|
|
96
|
-
}
|
|
97
|
-
|
|
95
|
+
}
|
|
96
|
+
if (!location && operatorLocation && context?.refMap) {
|
|
98
97
|
location = ConfigMessage.resolveOperatorLocation({
|
|
99
98
|
operatorLocation,
|
|
100
99
|
context
|
|
101
100
|
});
|
|
102
|
-
}
|
|
103
|
-
|
|
101
|
+
}
|
|
102
|
+
if (!location && filePath) {
|
|
104
103
|
location = ConfigMessage.resolveRawLocation({
|
|
105
104
|
filePath,
|
|
106
105
|
lineNumber: finalLineNumber,
|
|
@@ -25,8 +25,8 @@ import resolveConfigLocation from './resolveConfigLocation.js';
|
|
|
25
25
|
'link-refs': 'Invalid Link action page reference warnings',
|
|
26
26
|
'request-refs': 'Invalid Request action reference warnings',
|
|
27
27
|
'connection-refs': 'Nonexistent connection ID references',
|
|
28
|
-
types: 'All type validation (blocks, operators, actions, requests, connections)',
|
|
29
|
-
schema: 'JSON schema validation errors'
|
|
28
|
+
'types': 'All type validation (blocks, operators, actions, requests, connections)',
|
|
29
|
+
'schema': 'JSON schema validation errors'
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
* Base class for config message utilities.
|
|
@@ -87,16 +87,17 @@ import resolveConfigLocation from './resolveConfigLocation.js';
|
|
|
87
87
|
*/ static resolveOperatorLocation({ operatorLocation, context }) {
|
|
88
88
|
if (!operatorLocation) return null;
|
|
89
89
|
const refEntry = context?.refMap?.[operatorLocation.ref];
|
|
90
|
-
|
|
90
|
+
if (!refEntry?.path) return null;
|
|
91
|
+
const filePath = refEntry.path;
|
|
91
92
|
const lineNumber = operatorLocation.line;
|
|
92
|
-
|
|
93
|
-
let link = null;
|
|
93
|
+
let resolvedPath = filePath;
|
|
94
94
|
if (context?.directories?.config) {
|
|
95
|
-
|
|
95
|
+
resolvedPath = path.join(context.directories.config, filePath);
|
|
96
96
|
}
|
|
97
|
+
const source = lineNumber ? `${resolvedPath}:${lineNumber}` : resolvedPath;
|
|
97
98
|
return {
|
|
98
99
|
source,
|
|
99
|
-
link
|
|
100
|
+
link: source
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
@@ -108,14 +109,14 @@ import resolveConfigLocation from './resolveConfigLocation.js';
|
|
|
108
109
|
* @param {string} [params.configDirectory] - Config directory for link
|
|
109
110
|
* @returns {Object} Location object { source, link }
|
|
110
111
|
*/ static resolveRawLocation({ filePath, lineNumber, configDirectory }) {
|
|
111
|
-
|
|
112
|
-
let link = null;
|
|
112
|
+
let resolvedPath = filePath;
|
|
113
113
|
if (configDirectory) {
|
|
114
|
-
|
|
114
|
+
resolvedPath = path.join(configDirectory, filePath);
|
|
115
115
|
}
|
|
116
|
+
const source = lineNumber ? `${resolvedPath}:${lineNumber}` : resolvedPath;
|
|
116
117
|
return {
|
|
117
118
|
source,
|
|
118
|
-
link
|
|
119
|
+
link: source
|
|
119
120
|
};
|
|
120
121
|
}
|
|
121
122
|
};
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import ConfigError from './ConfigError.js';
|
|
16
16
|
import ConfigMessage from './ConfigMessage.js';
|
|
17
|
+
import formatErrorMessage from '../formatErrorMessage.js';
|
|
17
18
|
/**
|
|
18
19
|
* Build-time configuration warning class.
|
|
19
20
|
* All formatting happens in the constructor - properties are ready for the logger.
|
|
@@ -31,6 +32,9 @@ import ConfigMessage from './ConfigMessage.js';
|
|
|
31
32
|
* // Throws ConfigError in prod mode when prodError is true
|
|
32
33
|
* new ConfigWarning({ message, configKey, context, prodError: true });
|
|
33
34
|
*/ let ConfigWarning = class ConfigWarning {
|
|
35
|
+
print() {
|
|
36
|
+
return formatErrorMessage(this);
|
|
37
|
+
}
|
|
34
38
|
/**
|
|
35
39
|
* @param {Object} params
|
|
36
40
|
* @param {string} params.message - The warning message
|
|
@@ -57,6 +61,7 @@ import ConfigMessage from './ConfigMessage.js';
|
|
|
57
61
|
});
|
|
58
62
|
}
|
|
59
63
|
// Store all properties for the logger
|
|
64
|
+
this.name = 'Config Warning';
|
|
60
65
|
this.configKey = configKey ?? null;
|
|
61
66
|
this.checkSlug = checkSlug;
|
|
62
67
|
this.received = received;
|
|
@@ -73,7 +78,7 @@ import ConfigMessage from './ConfigMessage.js';
|
|
|
73
78
|
this.link = null;
|
|
74
79
|
return;
|
|
75
80
|
}
|
|
76
|
-
// Resolve location based on available info
|
|
81
|
+
// Resolve location based on available info, falling through if a method returns null
|
|
77
82
|
let location = null;
|
|
78
83
|
const configDir = configDirectory ?? context?.directories?.config;
|
|
79
84
|
if (configKey && context?.keyMap) {
|
|
@@ -81,12 +86,14 @@ import ConfigMessage from './ConfigMessage.js';
|
|
|
81
86
|
configKey,
|
|
82
87
|
context
|
|
83
88
|
});
|
|
84
|
-
}
|
|
89
|
+
}
|
|
90
|
+
if (!location && operatorLocation && context?.refMap) {
|
|
85
91
|
location = ConfigMessage.resolveOperatorLocation({
|
|
86
92
|
operatorLocation,
|
|
87
93
|
context
|
|
88
94
|
});
|
|
89
|
-
}
|
|
95
|
+
}
|
|
96
|
+
if (!location && filePath) {
|
|
90
97
|
location = ConfigMessage.resolveRawLocation({
|
|
91
98
|
filePath,
|
|
92
99
|
lineNumber,
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* configDirectory: '/Users/dev/myapp'
|
|
32
32
|
* });
|
|
33
33
|
* // Returns: {
|
|
34
|
-
* // source: 'pages/home.yaml:5',
|
|
34
|
+
* // source: '/Users/dev/myapp/pages/home.yaml:5',
|
|
35
35
|
* // config: 'root.pages[0:home].blocks[0:header]',
|
|
36
36
|
* // link: '/Users/dev/myapp/pages/home.yaml:5'
|
|
37
37
|
* // }
|
|
@@ -44,20 +44,18 @@
|
|
|
44
44
|
const lineNumber = keyEntry['~l'];
|
|
45
45
|
const refEntry = refMap?.[refId];
|
|
46
46
|
const filePath = refEntry?.path || 'lowdefy.yaml';
|
|
47
|
-
// source: filepath:line (e.g., "lowdefy.yaml:16")
|
|
48
|
-
const source = lineNumber ? `${filePath}:${lineNumber}` : filePath;
|
|
49
47
|
// config: the config path (e.g., "root.pages[0:home].blocks[0:header]")
|
|
50
48
|
const config = keyEntry.key;
|
|
51
|
-
//
|
|
52
|
-
let
|
|
49
|
+
// Use absolute path when configDirectory is available for clickable terminal links
|
|
50
|
+
let resolvedPath = filePath;
|
|
53
51
|
if (configDirectory) {
|
|
54
|
-
|
|
55
|
-
link = lineNumber ? `${absolutePath}:${lineNumber}` : absolutePath;
|
|
52
|
+
resolvedPath = path.resolve(configDirectory, filePath);
|
|
56
53
|
}
|
|
54
|
+
const source = lineNumber ? `${resolvedPath}:${lineNumber}` : resolvedPath;
|
|
57
55
|
return {
|
|
58
56
|
source,
|
|
59
57
|
config,
|
|
60
|
-
link
|
|
58
|
+
link: source
|
|
61
59
|
};
|
|
62
60
|
}
|
|
63
61
|
export default resolveConfigLocation;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import BaseLowdefyError from '../LowdefyError.js';
|
|
16
|
+
/**
|
|
17
|
+
* Client-side LowdefyError with server logging via API.
|
|
18
|
+
*
|
|
19
|
+
* Extends the base LowdefyError to add a log() method that sends
|
|
20
|
+
* the error to /api/client-error for terminal logging, then logs
|
|
21
|
+
* to the browser console.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const error = new LowdefyError('Unexpected condition');
|
|
25
|
+
* await error.log(lowdefy);
|
|
26
|
+
*/ let LowdefyError = class LowdefyError extends BaseLowdefyError {
|
|
27
|
+
/**
|
|
28
|
+
* Sends the error to the server for terminal logging and logs to console.
|
|
29
|
+
* @param {Object} [lowdefy] - Lowdefy context with basePath
|
|
30
|
+
* @param {Object} [options]
|
|
31
|
+
* @param {number} [options.timeout=1000] - Fetch timeout in ms
|
|
32
|
+
* @returns {Promise<void>}
|
|
33
|
+
*/ async log(lowdefy, { timeout = 1000 } = {}) {
|
|
34
|
+
const basePath = lowdefy?.basePath ?? '';
|
|
35
|
+
const controller = new AbortController();
|
|
36
|
+
const timeoutId = setTimeout(()=>controller.abort(), timeout);
|
|
37
|
+
try {
|
|
38
|
+
await fetch(`${basePath}/api/client-error`, {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: {
|
|
41
|
+
'Content-Type': 'application/json'
|
|
42
|
+
},
|
|
43
|
+
body: JSON.stringify(this.serialize()),
|
|
44
|
+
signal: controller.signal,
|
|
45
|
+
credentials: 'same-origin'
|
|
46
|
+
});
|
|
47
|
+
clearTimeout(timeoutId);
|
|
48
|
+
} catch {
|
|
49
|
+
clearTimeout(timeoutId);
|
|
50
|
+
// Server logging failed - continue with local console
|
|
51
|
+
}
|
|
52
|
+
console.error(this.print());
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export default LowdefyError;
|
package/dist/client/index.js
CHANGED
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
* await error.resolve(lowdefy);
|
|
25
25
|
*/ import ConfigError from './ConfigError.js';
|
|
26
26
|
import ConfigWarning from '../ConfigWarning.js';
|
|
27
|
-
import LowdefyError from '
|
|
27
|
+
import LowdefyError from './LowdefyError.js';
|
|
28
28
|
import PluginError from '../PluginError.js';
|
|
29
29
|
import ServiceError from '../ServiceError.js';
|
|
30
|
-
|
|
30
|
+
import UserError from '../UserError.js';
|
|
31
|
+
export { ConfigError, ConfigWarning, LowdefyError, PluginError, ServiceError, UserError };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ function formatErrorMessage(error, { includePrefix = true } = {}) {
|
|
16
|
+
if (typeof error === 'string') return error;
|
|
17
|
+
let message = error?.message || error?.rawMessage || error?.cause?.message || 'Unknown error';
|
|
18
|
+
if (error?.received !== undefined) {
|
|
19
|
+
try {
|
|
20
|
+
message = `${message} Received: ${JSON.stringify(error.received)}`;
|
|
21
|
+
} catch {
|
|
22
|
+
message = `${message} Received: [unserializable]`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (includePrefix) {
|
|
26
|
+
const name = error?.name || 'Error';
|
|
27
|
+
return `[${name}] ${message}`;
|
|
28
|
+
}
|
|
29
|
+
return message;
|
|
30
|
+
}
|
|
31
|
+
export default formatErrorMessage;
|
package/dist/index.js
CHANGED
|
@@ -45,4 +45,5 @@ import ConfigWarning from './ConfigWarning.js';
|
|
|
45
45
|
import LowdefyError from './LowdefyError.js';
|
|
46
46
|
import PluginError from './PluginError.js';
|
|
47
47
|
import ServiceError from './ServiceError.js';
|
|
48
|
-
|
|
48
|
+
import UserError from './UserError.js';
|
|
49
|
+
export { ConfigError, ConfigWarning, LowdefyError, PluginError, ServiceError, UserError };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/errors",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20260204101136",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy error classes for consistent error handling across build, server, and client",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|