mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
chore(lint): enable stricter error rules
This commit is contained in:
+29
-11
@@ -363,7 +363,7 @@ export async function runWatchMain(params = {}) {
|
||||
if (onSigTerm) {
|
||||
deps.process.off("SIGTERM", onSigTerm);
|
||||
}
|
||||
reject(err);
|
||||
reject(toLintErrorObject(err, "Non-Error rejection"));
|
||||
};
|
||||
|
||||
const resolveCreateWatcher = async () => {
|
||||
@@ -484,20 +484,38 @@ export async function runWatchMain(params = {}) {
|
||||
startRunner();
|
||||
startWatcher();
|
||||
})
|
||||
.catch((error) => {
|
||||
logWatcher(`Failed to acquire watcher lock: ${error?.message ?? "unknown error"}`, deps);
|
||||
settle(1);
|
||||
});
|
||||
.catch(
|
||||
/** @param {unknown} error */ (error) => {
|
||||
logWatcher(`Failed to acquire watcher lock: ${error?.message ?? "unknown error"}`, deps);
|
||||
settle(1);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
||||
void runWatchMain()
|
||||
.then((code) => process.exit(code))
|
||||
.catch((err) => {
|
||||
if (!isInvalidPackageConfigError(err)) {
|
||||
console.error(err);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
.catch(
|
||||
/** @param {unknown} err */ (err) => {
|
||||
if (!isInvalidPackageConfigError(err)) {
|
||||
console.error(err);
|
||||
}
|
||||
process.exit(1);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function toLintErrorObject(value, fallbackMessage) {
|
||||
if (value instanceof Error) {
|
||||
return value;
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
return new Error(value);
|
||||
}
|
||||
const error = new Error(fallbackMessage, { cause: value });
|
||||
if ((typeof value === "object" && value !== null) || typeof value === "function") {
|
||||
Object.assign(error, value);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user