java - What is the best runtime exception to use when mandatory input is missing -


i have service, simple class need take input , run business logic. before executing service, user must set data. in general, this:

public class testservice extends innerservicebase {      /**      * mandatory input       */     private  object inputobj;      @override     protected errorcode executeimpl() {         //some business logic on inputobj         return null;     }      public void setinputobj(object inputobj) {         this.inputobj = inputobj;     } }  

what best runtime exception throw in case inputobj null ?

illegalstateexception seems best fit. object not in correct state have executeimpl() called on it. whatever exception use, make sure error message helpful.

whether should using unchecked exception @ whole other question...


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -