You can throw away any object you want:
try { var x = 1/0; } catch (e) { throw new MyException("There is no joy in Mudville", e); } function MyException(text, internal_exception) { this.text = text; this.internal_exception = internal_exception; }
Then an error of type MyException will appear with the text and internal_exception properties.
user663031
source share