G
Guest
Should I throw an exception in the following scenario?
I have a user class. The constructor takes one argument, the sessionid of
the user. This sessionid corresponds to an entry in a database. The
constructor calls the database with the passed in sessionid to retrieve the
user info. If the database call returns no rows, should I throw an exception
or return some kind of error code from the constructor?
I have a user class. The constructor takes one argument, the sessionid of
the user. This sessionid corresponds to an entry in a database. The
constructor calls the database with the passed in sessionid to retrieve the
user info. If the database call returns no rows, should I throw an exception
or return some kind of error code from the constructor?