gwt rpc - GWT - Throwing an exception vs returning null -


suppose have method implemented on server side:

@override public user login(string username, string password) throws authenticationfailedexception {     // obtain hash user's db entry - omitted simplify code      string sessionid = uuid.randomuuid().tostring();     currentlyloggedin.put(sessionid, new session(username));      return new user(sessionid, username); } 

the method takes username , password, retrieves password database , checks if valid. if valid, returns user object generated sessionid , username. if method fails? or in general, best approach if method not succeed? return null, or throw exception?

always return exception. null can mean whatever, exception can have attached message explaining reason of problem. , that's not applicable gwt, java.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -