mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-27 17:11:46 +00:00
chore: filter noisy warnings
This commit is contained in:
@@ -1,22 +1,10 @@
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
import { installProcessWarningFilter } from "../infra/warnings.js";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
export function requireNodeSqlite(): typeof import("node:sqlite") {
|
||||
const onWarning = (warning: Error & { name?: string; message?: string }) => {
|
||||
if (
|
||||
warning.name === "ExperimentalWarning" &&
|
||||
warning.message?.includes("SQLite is an experimental feature")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
process.stderr.write(`${warning.stack ?? warning.toString()}\n`);
|
||||
};
|
||||
|
||||
process.on("warning", onWarning);
|
||||
try {
|
||||
return require("node:sqlite") as typeof import("node:sqlite");
|
||||
} finally {
|
||||
process.off("warning", onWarning);
|
||||
}
|
||||
installProcessWarningFilter();
|
||||
return require("node:sqlite") as typeof import("node:sqlite");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user