adding a check for JRuby's error