Capture original error stack when sending messages
This commit is contained in:
parent
a4c6003f34
commit
74de4ea6f6
2 changed files with 10 additions and 1 deletions
|
@ -74,6 +74,7 @@ declare global {
|
||||||
}
|
}
|
||||||
interface Error {
|
interface Error {
|
||||||
reason?: any;
|
reason?: any;
|
||||||
|
stackForLog?: string;
|
||||||
sender?: SignalProtocolAddressClass;
|
sender?: SignalProtocolAddressClass;
|
||||||
senderUuid?: SignalProtocolAddressClass;
|
senderUuid?: SignalProtocolAddressClass;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,13 @@ export default class OutgoingMessage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
registerError(identifier: string, reason: string, error?: Error): void {
|
registerError(
|
||||||
|
identifier: string,
|
||||||
|
reason: string,
|
||||||
|
providedError?: Error
|
||||||
|
): void {
|
||||||
|
let error = providedError;
|
||||||
|
|
||||||
if (!error || (error.name === 'HTTPError' && error.code !== 404)) {
|
if (!error || (error.name === 'HTTPError' && error.code !== 404)) {
|
||||||
error = new OutgoingMessageError(
|
error = new OutgoingMessageError(
|
||||||
identifier,
|
identifier,
|
||||||
|
@ -124,6 +130,8 @@ export default class OutgoingMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
error.reason = reason;
|
error.reason = reason;
|
||||||
|
error.stackForLog = providedError ? providedError.stack : undefined;
|
||||||
|
|
||||||
this.errors[this.errors.length] = error;
|
this.errors[this.errors.length] = error;
|
||||||
this.numberCompleted();
|
this.numberCompleted();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue