note 121093 added to class.outofrangeexception
| From: | Jakub | Date: | Tue, 16 May 2017 23:59:25 +0000 |
| Subject: | note 121093 added to class.outofrangeexception | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209063@lists.php.net to get a copy of this message | ||
I see this in this way:
By definiton, OutOfRangeException should be use to when potential problem is logical - occurs
because of wrong code or definition. OutOfBoundsException is for runtime.
Example (see also note in "OutOfBoundsException class" article):
<?php
function prepareData(PDOStatement $s) {
$x = $s->fetch();
if (!isset($x['secretColumn']))
throw new OutOfRangeException ("Secret column doesn't exist! Verify table
definition and query.");
}
----
Server IP: 72.52.91.14
Probable Submitter: 5.173.75.153
----
Manual Page -- http://php.net/manual/en/class.outofrangeexception.php
Edit -- https://master.php.net/note/edit/121093
Del: integrated -- https://master.php.net/note/delete/121093/integrated
Del: useless -- https://master.php.net/note/delete/121093/useless
Del: bad code -- https://master.php.net/note/delete/121093/bad+code
Del: spam -- https://master.php.net/note/delete/121093/spam
Del: non-english -- https://master.php.net/note/delete/121093/non-english
Del: in docs -- https://master.php.net/note/delete/121093/in+docs
Del: other reasons-- https://master.php.net/note/delete/121093
Reject -- https://master.php.net/note/reject/121093
Search -- https://master.php.net/manage/user-notes.php