I think this should throw an exception directly, instead of throwing an exception in JS code.