Skip to content

Commit 956817f

Browse files
committed
chore: Clean up messages for not-found hotpatches
1 parent 88dd00a commit 956817f

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/ps/commands/hotpatch.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Sentinel from '@/sentinel';
2-
import { ChatError } from '@/utils/chatError';
32

43
import type { NoTranslate } from '@/i18n/types';
54
import type { PSCommand } from '@/types/chat';
@@ -21,7 +20,7 @@ export const command: PSCommand = {
2120
} catch (err) {
2221
if (err instanceof Error) {
2322
err.message = `${type}: ${err.message}`;
24-
if (!(err instanceof ChatError)) throw err;
23+
throw err;
2524
}
2625
return err as string;
2726
}

src/sentinel/hotpatch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ export async function hotpatch(this: Sentinel, hotpatchType: HotpatchType, by: s
133133

134134
default:
135135
const register = registers.list.find(register => register.label === hotpatchType);
136-
if (!register) throw new ChatError(`Hotpatch type ${hotpatchType} not found.` as NoTranslate);
136+
if (!register) throw new ChatError(`Type not found.` as NoTranslate);
137137
const allFiles = (await fs.readdir(fsPath(), { recursive: true, withFileTypes: true }))
138138
.filter(entry => entry.isFile())
139139
.map(entry => path.join(entry.parentPath, entry.name));
140140
await register.reload(allFiles.filter(file => register.pattern.test(file)));
141141
}
142142
Logger.log(`${hotpatchType} was hotpatched ${typeof by === 'symbol' ? `(${Symbol.keyFor(by) ?? '-'})` : `by ${by}`}`);
143143
} catch (error) {
144-
if (error instanceof Error) {
144+
if (error instanceof Error && !(error instanceof ChatError)) {
145145
Logger.log('Failed to hotpatch', hotpatchType, by, error.message);
146146
Logger.errorLog(error);
147147
}

0 commit comments

Comments
 (0)