The code to use the existing exception in ECMAException.create will use an inherited nashornException property, causing catch clauses to be executed with the prototype object instead of the actual thrown object. Code to reproduce: function CustomError() {} CustomError.prototype = new Error(); var c = new CustomError(); try { throw c; } catch (e) { print(e === c); print(e === CustomError.prototype); }