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

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -