dbgate-tools 5.5.4-alpha.4 → 5.5.4-alpha.7
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/lib/stringTools.d.ts +2 -0
- package/lib/stringTools.js +11 -2
- package/package.json +3 -3
package/lib/stringTools.d.ts
CHANGED
|
@@ -25,7 +25,9 @@ export declare function getConvertValueMenu(value: any, onSetValue: any, editorT
|
|
|
25
25
|
onClick: () => any;
|
|
26
26
|
}[];
|
|
27
27
|
export declare function extractErrorMessage(err: any, defaultMessage?: string): any;
|
|
28
|
+
export declare function extractErrorStackTrace(err: any): string;
|
|
28
29
|
export declare function extractErrorLogData(err: any, additionalFields?: {}): {
|
|
29
30
|
errorMessage: any;
|
|
30
31
|
errorObject: any;
|
|
32
|
+
errorStack: string;
|
|
31
33
|
};
|
package/lib/stringTools.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.extractErrorLogData = exports.extractErrorMessage = exports.getConvertValueMenu = exports.detectTypeIcon = exports.detectCellDataType = exports.parseSqlDefaultValue = exports.getAsImageSrc = exports.arrayBufferToBase64 = exports.isWktGeometry = exports.getIconForRedisType = exports.isJsonLikeLongString = exports.shouldOpenMultilineDialog = exports.safeJsonParse = exports.stringifyCellValue = exports.parseCellValue = exports.hexStringToArray = exports.arrayToHexString = void 0;
|
|
6
|
+
exports.extractErrorLogData = exports.extractErrorStackTrace = exports.extractErrorMessage = exports.getConvertValueMenu = exports.detectTypeIcon = exports.detectCellDataType = exports.parseSqlDefaultValue = exports.getAsImageSrc = exports.arrayBufferToBase64 = exports.isWktGeometry = exports.getIconForRedisType = exports.isJsonLikeLongString = exports.shouldOpenMultilineDialog = exports.safeJsonParse = exports.stringifyCellValue = exports.parseCellValue = exports.hexStringToArray = exports.arrayToHexString = void 0;
|
|
7
7
|
const isString_1 = __importDefault(require("lodash/isString"));
|
|
8
8
|
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
9
9
|
const isNumber_1 = __importDefault(require("lodash/isNumber"));
|
|
@@ -462,9 +462,18 @@ function extractErrorMessage(err, defaultMessage = 'Unknown error') {
|
|
|
462
462
|
return defaultMessage;
|
|
463
463
|
}
|
|
464
464
|
exports.extractErrorMessage = extractErrorMessage;
|
|
465
|
+
function extractErrorStackTrace(err) {
|
|
466
|
+
const { stack } = err;
|
|
467
|
+
if (!(0, isString_1.default)(stack))
|
|
468
|
+
return undefined;
|
|
469
|
+
if (stack.length > 1000)
|
|
470
|
+
return stack.substring(0, 1000) + '... (truncated)';
|
|
471
|
+
return stack;
|
|
472
|
+
}
|
|
473
|
+
exports.extractErrorStackTrace = extractErrorStackTrace;
|
|
465
474
|
function extractErrorLogData(err, additionalFields = {}) {
|
|
466
475
|
if (!err)
|
|
467
476
|
return null;
|
|
468
|
-
return Object.assign({ errorMessage: extractErrorMessage(err), errorObject: err }, additionalFields);
|
|
477
|
+
return Object.assign({ errorMessage: extractErrorMessage(err), errorObject: err, errorStack: extractErrorStackTrace(err) }, additionalFields);
|
|
469
478
|
}
|
|
470
479
|
exports.extractErrorLogData = extractErrorLogData;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.5.4-alpha.
|
|
2
|
+
"version": "5.5.4-alpha.7",
|
|
3
3
|
"name": "dbgate-tools",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^13.7.0",
|
|
28
|
-
"dbgate-types": "^5.5.4-alpha.
|
|
28
|
+
"dbgate-types": "^5.5.4-alpha.7",
|
|
29
29
|
"jest": "^24.9.0",
|
|
30
30
|
"ts-jest": "^25.2.1",
|
|
31
31
|
"typescript": "^4.4.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"dbgate-query-splitter": "^4.10.5",
|
|
35
|
-
"dbgate-sqltree": "^5.5.4-alpha.
|
|
35
|
+
"dbgate-sqltree": "^5.5.4-alpha.7",
|
|
36
36
|
"debug": "^4.3.4",
|
|
37
37
|
"json-stable-stringify": "^1.0.1",
|
|
38
38
|
"lodash": "^4.17.21",
|