php - using OutOfBoundsException for non arrays -
say have method takes in values between 0 , x. if parameter greater x or less 0 want throw exception. outofboundsexception
reasonable exception throw?
http://php.net/manual/en/class.runtimeexception.php says "exception thrown if value not valid key". since i'm not using exception arrays (and henceforth keys) still okay if use it?
i mean, on 1 hand, seems doesn't matter. if threw badmethodcallexception
exception , person using method knew , either catching or exception
seems that'd sufficient, it'd nice have exceptions make sense too.
it should fine , appropriate use this. exceptions aren't tightly-coupled original uses. it's "out of bounds" outside range of allowed values, makes sense.
Comments
Post a Comment