fix: preserve error cause, fix test mock typing
- Add { cause: err } to thrown Error for upstream debugging
- Use 'as unknown as string' cast for undefined-id test mock
This commit is contained in:
parent
cd0d45b184
commit
ef9e8d0619
@ -646,7 +646,7 @@ describe("monitorDiscordProvider", () => {
|
||||
const { monitorDiscordProvider } = await import("./provider.js");
|
||||
const runtime = baseRuntime();
|
||||
|
||||
clientFetchUserMock.mockResolvedValueOnce({ id: undefined, username: "NoId" });
|
||||
clientFetchUserMock.mockResolvedValueOnce({ id: undefined as unknown as string, username: "NoId" });
|
||||
|
||||
await expect(
|
||||
monitorDiscordProvider({
|
||||
|
||||
@ -884,7 +884,7 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
|
||||
// messages pass through), self-message filtering is disabled (risk of
|
||||
// self-reply loops), and reply detection is broken. Let auto-restart
|
||||
// retry instead of running in a degraded state. See #42219.
|
||||
throw new Error(`discord: cannot start without bot identity: ${String(err)}`);
|
||||
throw new Error(`discord: cannot start without bot identity: ${String(err)}`, { cause: err });
|
||||
}
|
||||
if (!botUserId) {
|
||||
// fetchUser succeeded but returned no id — equally unsafe to continue.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user