Is your feature request related to a problem? Please describe.
When you are rethrowing an error with a nicer error message currently the stacktrace of the inner exception gets lost.
try {
connectToDatabase();
} catch (err) {
throw new Error("Connecting to database failed.", { cause: err });
}
This currently only tracks the stack trace from the new error but not from the inner error.
The Crashed.d.ts file contains a definition for innerException but as far as I can tell this is actually never used in any real code:
Crashes.ExceptionModel = class {
wrapperSdkName = 'appcenter.react-native';
constructor(type, message, stack) {
this.type = type;
this.message = message;
this.stackTrace = stack;
}
// Error value should have Error type.
static createFromError(error) {
return new this(error.name, error.message, error.stack);
}
static createFromTypeAndMessage(type, message, stacktrace) {
return new this(type, message, stacktrace);
}
};
Describe the solution you'd like
ExceptionModel.createFromError should correctly resolve the ES2022 standard field cause and log a correct combined stacktrace.
Describe alternatives you've considered
Allow at least to supply an innner exception as a separate paramter (and also implement it for real instead of just providing a typing which no real code).
Is your feature request related to a problem? Please describe. When you are rethrowing an error with a nicer error message currently the stacktrace of the inner exception gets lost.
This currently only tracks the stack trace from the new error but not from the inner error.
The
Crashed.d.ts
file contains a definition forinnerException
but as far as I can tell this is actually never used in any real code:Describe the solution you'd like ExceptionModel.createFromError should correctly resolve the ES2022 standard field
cause
and log a correct combined stacktrace.Describe alternatives you've considered Allow at least to supply an innner exception as a separate paramter (and also implement it for real instead of just providing a typing which no real code).