fix: imessage dm replies and error details (#935)

This commit is contained in:
Peter Steinberger
2026-01-15 07:58:44 +00:00
parent 9c04a79c0a
commit a5a9788b20
7 changed files with 88 additions and 6 deletions

View File

@@ -180,7 +180,17 @@ export class IMessageRpcClient {
this.pending.delete(key);
if (parsed.error) {
const msg = parsed.error.message ?? "imsg rpc error";
const baseMessage = parsed.error.message ?? "imsg rpc error";
const details = parsed.error.data;
const code = parsed.error.code;
const suffixes = [] as string[];
if (typeof code === "number") suffixes.push(`code=${code}`);
if (details !== undefined) {
const detailText =
typeof details === "string" ? details : JSON.stringify(details, null, 2);
if (detailText) suffixes.push(detailText);
}
const msg = suffixes.length > 0 ? `${baseMessage}: ${suffixes.join(" ")}` : baseMessage;
pending.reject(new Error(msg));
return;
}