Use JError instead of throw new Exception