mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 11:57:27 +00:00
fix: improve sqlite missing runtime error
This commit is contained in:
@@ -5,5 +5,15 @@ const require = createRequire(import.meta.url);
|
||||
|
||||
export function requireNodeSqlite(): typeof import("node:sqlite") {
|
||||
installProcessWarningFilter();
|
||||
return require("node:sqlite") as typeof import("node:sqlite");
|
||||
try {
|
||||
return require("node:sqlite") as typeof import("node:sqlite");
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
// Node distributions can ship without the experimental builtin SQLite module.
|
||||
// Surface an actionable error instead of the generic "unknown builtin module".
|
||||
throw new Error(
|
||||
`SQLite support is unavailable in this Node runtime (missing node:sqlite). ${message}`,
|
||||
{ cause: err },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user