@prisma/adapter-mariadb 6.14.0-dev.4 → 6.14.0-dev.40
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/index.js +10 -3
- package/dist/index.mjs +10 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -139,9 +139,16 @@ var typeCast = (field, next) => {
|
|
|
139
139
|
|
|
140
140
|
// src/errors.ts
|
|
141
141
|
function convertDriverError(error) {
|
|
142
|
-
if (
|
|
143
|
-
|
|
142
|
+
if (isDriverError(error)) {
|
|
143
|
+
return {
|
|
144
|
+
originalCode: error.errno.toString(),
|
|
145
|
+
originalMessage: error.sqlMessage ?? "N/A",
|
|
146
|
+
...mapDriverError(error)
|
|
147
|
+
};
|
|
144
148
|
}
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
function mapDriverError(error) {
|
|
145
152
|
switch (error.errno) {
|
|
146
153
|
case 1062: {
|
|
147
154
|
const index = error.sqlMessage?.split(" ").pop()?.split("'").at(1)?.split(".").pop();
|
|
@@ -250,7 +257,7 @@ function convertDriverError(error) {
|
|
|
250
257
|
};
|
|
251
258
|
}
|
|
252
259
|
}
|
|
253
|
-
function
|
|
260
|
+
function isDriverError(error) {
|
|
254
261
|
return typeof error.errno === "number" && (typeof error.sqlMessage === "string" || error.sqlMessage === null) && (typeof error.sqlState === "string" || error.sqlState === null);
|
|
255
262
|
}
|
|
256
263
|
|
package/dist/index.mjs
CHANGED
|
@@ -103,9 +103,16 @@ var typeCast = (field, next) => {
|
|
|
103
103
|
|
|
104
104
|
// src/errors.ts
|
|
105
105
|
function convertDriverError(error) {
|
|
106
|
-
if (
|
|
107
|
-
|
|
106
|
+
if (isDriverError(error)) {
|
|
107
|
+
return {
|
|
108
|
+
originalCode: error.errno.toString(),
|
|
109
|
+
originalMessage: error.sqlMessage ?? "N/A",
|
|
110
|
+
...mapDriverError(error)
|
|
111
|
+
};
|
|
108
112
|
}
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
function mapDriverError(error) {
|
|
109
116
|
switch (error.errno) {
|
|
110
117
|
case 1062: {
|
|
111
118
|
const index = error.sqlMessage?.split(" ").pop()?.split("'").at(1)?.split(".").pop();
|
|
@@ -214,7 +221,7 @@ function convertDriverError(error) {
|
|
|
214
221
|
};
|
|
215
222
|
}
|
|
216
223
|
}
|
|
217
|
-
function
|
|
224
|
+
function isDriverError(error) {
|
|
218
225
|
return typeof error.errno === "number" && (typeof error.sqlMessage === "string" || error.sqlMessage === null) && (typeof error.sqlState === "string" || error.sqlState === null);
|
|
219
226
|
}
|
|
220
227
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-mariadb",
|
|
3
|
-
"version": "6.14.0-dev.
|
|
3
|
+
"version": "6.14.0-dev.40",
|
|
4
4
|
"description": "Prisma's driver adapter for \"mariadb\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"mariadb": "3.4.2",
|
|
35
|
-
"@prisma/driver-adapter-utils": "6.14.0-dev.
|
|
35
|
+
"@prisma/driver-adapter-utils": "6.14.0-dev.40"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"vitest": "3.0.9"
|