Properly raise java exceptions as pretty js ones