[Javascript] Error Cause
class Product {
name;
price;
constructor(name, price) {
this.name = name;
try {
this.price = price * 1.30;
} catch(e) {
throw new Error("Product cannot be created", {cause: e})
}
}
}
When you throw the error, also mention where is the cause of original error by using cause