You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Error.cause proposal has reached stage 4 and implementation is widespread enough that we can count on all major browsers and all LTS supported NodeJS versions to work with it as well.
This is revolutionary when it comes to error handling in Javascript/Typescript because up until now you had to have a convention enforced (painstakingly via code reviews) for making sure that junior talent does not lose the cause of exceptions thrown in the code.
While this is still a possibility, it was made much harder with the new Error.cause API
Project-wide upgrade to Typescript target of ES2022 so that we can use
the new Error APIs.
Wherever possible we should now use the new `cause`
property of the built-in `Error` type in combination
with the `asError(unknown)` utility function:
```typescript
import { asError } from "@hyperledger/cactus-common";
try {
await performSomeImportantOperation();
} catch (ex: unknown) {
const cause = asError(ex);
throw new Error("Something went wrong while doing something.", { cause });
}
```
More information about the EcmaScript proposal that made this possible:
https://github.com/tc39/proposal-error-causeFixeshyperledger-cacti#3592
Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Project-wide upgrade to Typescript target of ES2022 so that we can use
the new Error APIs.
Wherever possible we should now use the new `cause`
property of the built-in `Error` type in combination
with the `asError(unknown)` utility function:
```typescript
import { asError } from "@hyperledger/cactus-common";
try {
await performSomeImportantOperation();
} catch (ex: unknown) {
const cause = asError(ex);
throw new Error("Something went wrong while doing something.", { cause });
}
```
More information about the EcmaScript proposal that made this possible:
https://github.com/tc39/proposal-error-causeFixeshyperledger-cacti#3592
Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Description
The Error.cause proposal has reached stage 4 and implementation is widespread enough that we can count on all major browsers and all LTS supported NodeJS versions to work with it as well.
This is revolutionary when it comes to error handling in Javascript/Typescript because up until now you had to have a convention enforced (painstakingly via code reviews) for making sure that junior talent does not lose the cause of exceptions thrown in the code.
While this is still a possibility, it was made much harder with the new Error.cause API
https://github.com/tc39/proposal-error-cause
Acceptance Criteria
The text was updated successfully, but these errors were encountered: