@adep/runtime 0.3.5 → 0.3.6
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 +14 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1024,6 +1024,20 @@ var CLOUD_DB_SPEC = {
|
|
|
1024
1024
|
};
|
|
1025
1025
|
var WRITE_TERMINALS = /* @__PURE__ */ new Set(["insert", "insertMany", "update", "delete"]);
|
|
1026
1026
|
function errorWithCode(error) {
|
|
1027
|
+
if (error instanceof Error) {
|
|
1028
|
+
const sqlite = /no such table: (\S+)/.exec(error.message);
|
|
1029
|
+
if (sqlite !== null) {
|
|
1030
|
+
return new Error(
|
|
1031
|
+
`[DB_TABLE_MISSING] \u9879\u76EE\u5E93\u5DF2\u542F\u52A8\u4F46\u7F3A\u8868 "${sqlite[1]}"\uFF1A\u8BF7\u6267\u884C adep db migrate <schema.sql> \u5EFA\u8868\uFF08\u53D1\u5E03\u4E0D\u542B\u5EFA\u8868\uFF09\u3002\u539F\u59CB\u9519\u8BEF\uFF1A${error.message}`
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
const pg = /relation "([^"]+)" does not exist/.exec(error.message);
|
|
1035
|
+
if (pg !== null) {
|
|
1036
|
+
return new Error(
|
|
1037
|
+
`[DB_TABLE_MISSING] \u9879\u76EE\u5E93\u5DF2\u542F\u52A8\u4F46\u7F3A\u8868\uFF08\u6216\u5173\u7CFB\uFF09"${pg[1]}"\uFF1A\u8BF7\u6267\u884C adep db migrate <schema.sql> \u5EFA\u8868\uFF08\u53D1\u5E03\u4E0D\u542B\u5EFA\u8868\uFF09\u3002\u539F\u59CB\u9519\u8BEF\uFF1A${error.message}`
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1027
1041
|
const code = typeof error === "object" && error !== null && typeof error.code === "string" ? error.code : void 0;
|
|
1028
1042
|
if (code !== void 0 && error instanceof Error) {
|
|
1029
1043
|
return new Error(`[${code}] ${error.message}`);
|