@prisma/adapter-d1 6.14.0-dev.2 → 6.14.0-dev.20
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 -4
- package/dist/index.mjs +10 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -189,9 +189,15 @@ function mapRow(result, columnTypes) {
|
|
|
189
189
|
|
|
190
190
|
// src/errors.ts
|
|
191
191
|
function convertDriverError(error) {
|
|
192
|
-
if (
|
|
193
|
-
|
|
192
|
+
if (isDriverError(error)) {
|
|
193
|
+
return {
|
|
194
|
+
originalMessage: error.message,
|
|
195
|
+
...mapDriverError(error)
|
|
196
|
+
};
|
|
194
197
|
}
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
function mapDriverError(error) {
|
|
195
201
|
let stripped = error.message.split("D1_ERROR: ").at(1) ?? error.message;
|
|
196
202
|
stripped = stripped.split("SqliteError: ").at(1) ?? stripped;
|
|
197
203
|
if (stripped.startsWith("UNIQUE constraint failed") || stripped.startsWith("PRIMARY KEY constraint failed")) {
|
|
@@ -233,8 +239,8 @@ function convertDriverError(error) {
|
|
|
233
239
|
message: error.message
|
|
234
240
|
};
|
|
235
241
|
}
|
|
236
|
-
function
|
|
237
|
-
return typeof error
|
|
242
|
+
function isDriverError(error) {
|
|
243
|
+
return typeof error["message"] === "string";
|
|
238
244
|
}
|
|
239
245
|
|
|
240
246
|
// src/utils.ts
|
package/dist/index.mjs
CHANGED
|
@@ -155,9 +155,15 @@ function mapRow(result, columnTypes) {
|
|
|
155
155
|
|
|
156
156
|
// src/errors.ts
|
|
157
157
|
function convertDriverError(error) {
|
|
158
|
-
if (
|
|
159
|
-
|
|
158
|
+
if (isDriverError(error)) {
|
|
159
|
+
return {
|
|
160
|
+
originalMessage: error.message,
|
|
161
|
+
...mapDriverError(error)
|
|
162
|
+
};
|
|
160
163
|
}
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
function mapDriverError(error) {
|
|
161
167
|
let stripped = error.message.split("D1_ERROR: ").at(1) ?? error.message;
|
|
162
168
|
stripped = stripped.split("SqliteError: ").at(1) ?? stripped;
|
|
163
169
|
if (stripped.startsWith("UNIQUE constraint failed") || stripped.startsWith("PRIMARY KEY constraint failed")) {
|
|
@@ -199,8 +205,8 @@ function convertDriverError(error) {
|
|
|
199
205
|
message: error.message
|
|
200
206
|
};
|
|
201
207
|
}
|
|
202
|
-
function
|
|
203
|
-
return typeof error
|
|
208
|
+
function isDriverError(error) {
|
|
209
|
+
return typeof error["message"] === "string";
|
|
204
210
|
}
|
|
205
211
|
|
|
206
212
|
// src/utils.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-d1",
|
|
3
|
-
"version": "6.14.0-dev.
|
|
3
|
+
"version": "6.14.0-dev.20",
|
|
4
4
|
"description": "Prisma's driver adapter for Cloudflare D1",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@cloudflare/workers-types": "4.20250214.0",
|
|
39
39
|
"ky": "1.7.5",
|
|
40
|
-
"@prisma/driver-adapter-utils": "6.14.0-dev.
|
|
40
|
+
"@prisma/driver-adapter-utils": "6.14.0-dev.20"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"vitest": "3.0.9"
|