@sprucelabs/data-stores 28.3.256 → 28.3.257
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.
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const error_1 = __importDefault(require("@sprucelabs/error"));
|
7
7
|
class SpruceError extends error_1.default {
|
8
8
|
friendlyMessage() {
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
10
10
|
const { options } = this;
|
11
11
|
let message;
|
12
12
|
switch (options === null || options === void 0 ? void 0 : options.code) {
|
@@ -71,7 +71,8 @@ class SpruceError extends error_1.default {
|
|
71
71
|
message = `Something went wrong with the database, the message is:\n\n"${options.databaseErrorMessage}"`;
|
72
72
|
break;
|
73
73
|
case 'UNABLE_TO_CONNECT_TO_DB':
|
74
|
-
message =
|
74
|
+
message =
|
75
|
+
(_h = (_f = (_e = options.originalError) === null || _e === void 0 ? void 0 : _e.stack) !== null && _f !== void 0 ? _f : (_g = options.originalError) === null || _g === void 0 ? void 0 : _g.message) !== null && _h !== void 0 ? _h : `I could not connect to a dabatase. Installing mongo is a great first step to solving this!
|
75
76
|
|
76
77
|
https://www.mongodb.com/try/download/community
|
77
78
|
|
@@ -98,7 +99,7 @@ If you are on a mac, using brew is recommended: https://brew.sh`;
|
|
98
99
|
message = 'Unknown error!';
|
99
100
|
break;
|
100
101
|
case 'DUPLICATE_KEY':
|
101
|
-
message = `An index was trying to be created that exists. Original error is:\n\n${(
|
102
|
+
message = `An index was trying to be created that exists. Original error is:\n\n${(_l = (_j = options.friendlyMessage) !== null && _j !== void 0 ? _j : (_k = options.originalError) === null || _k === void 0 ? void 0 : _k.stack) !== null && _l !== void 0 ? _l : (_m = options.originalError) === null || _m === void 0 ? void 0 : _m.message}`;
|
102
103
|
break;
|
103
104
|
case 'INVALID_CONNECTION_STRING_SCHEME':
|
104
105
|
message = `There is no database adapter setup for: ${options.connectionString.split('://')[0]}. You may need to install a plugin to support this database using env.DB_ADAPTER and 'yarn add ...'`;
|
@@ -115,7 +116,7 @@ If you are on a mac, using brew is recommended: https://brew.sh`;
|
|
115
116
|
default:
|
116
117
|
message = super.friendlyMessage();
|
117
118
|
}
|
118
|
-
const fullMessage = (
|
119
|
+
const fullMessage = (_o = options.friendlyMessage) !== null && _o !== void 0 ? _o : message;
|
119
120
|
return fullMessage;
|
120
121
|
}
|
121
122
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import AbstractSpruceError from '@sprucelabs/error';
|
2
2
|
export default class SpruceError extends AbstractSpruceError {
|
3
3
|
friendlyMessage() {
|
4
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
4
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
5
5
|
const { options } = this;
|
6
6
|
let message;
|
7
7
|
switch (options === null || options === void 0 ? void 0 : options.code) {
|
@@ -66,7 +66,8 @@ export default class SpruceError extends AbstractSpruceError {
|
|
66
66
|
message = `Something went wrong with the database, the message is:\n\n"${options.databaseErrorMessage}"`;
|
67
67
|
break;
|
68
68
|
case 'UNABLE_TO_CONNECT_TO_DB':
|
69
|
-
message =
|
69
|
+
message =
|
70
|
+
(_h = (_f = (_e = options.originalError) === null || _e === void 0 ? void 0 : _e.stack) !== null && _f !== void 0 ? _f : (_g = options.originalError) === null || _g === void 0 ? void 0 : _g.message) !== null && _h !== void 0 ? _h : `I could not connect to a dabatase. Installing mongo is a great first step to solving this!
|
70
71
|
|
71
72
|
https://www.mongodb.com/try/download/community
|
72
73
|
|
@@ -93,7 +94,7 @@ If you are on a mac, using brew is recommended: https://brew.sh`;
|
|
93
94
|
message = 'Unknown error!';
|
94
95
|
break;
|
95
96
|
case 'DUPLICATE_KEY':
|
96
|
-
message = `An index was trying to be created that exists. Original error is:\n\n${(
|
97
|
+
message = `An index was trying to be created that exists. Original error is:\n\n${(_l = (_j = options.friendlyMessage) !== null && _j !== void 0 ? _j : (_k = options.originalError) === null || _k === void 0 ? void 0 : _k.stack) !== null && _l !== void 0 ? _l : (_m = options.originalError) === null || _m === void 0 ? void 0 : _m.message}`;
|
97
98
|
break;
|
98
99
|
case 'INVALID_CONNECTION_STRING_SCHEME':
|
99
100
|
message = `There is no database adapter setup for: ${options.connectionString.split('://')[0]}. You may need to install a plugin to support this database using env.DB_ADAPTER and 'yarn add ...'`;
|
@@ -110,7 +111,7 @@ If you are on a mac, using brew is recommended: https://brew.sh`;
|
|
110
111
|
default:
|
111
112
|
message = super.friendlyMessage();
|
112
113
|
}
|
113
|
-
const fullMessage = (
|
114
|
+
const fullMessage = (_o = options.friendlyMessage) !== null && _o !== void 0 ? _o : message;
|
114
115
|
return fullMessage;
|
115
116
|
}
|
116
117
|
}
|