Catch an error for JRuby