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

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -