Req #55542 [Asn]: SNMP class should use Exceptions instead of PHP Errors
Edit report at https://bugs.php.net/bug.php?id=55542&edit=1
ID: 55542
Updated by: ch@php.net
Reported by: ch@php.net
Summary: SNMP class should use Exceptions instead of PHP
Errors
Status: Assigned
Type: Feature/Change Request
Package: SNMP related
PHP Version: 5.4.0alpha3
Assigned To: lytboris
Block user comment: N
Private report: N
New Comment:
But PDO has a history back to PHP4 or the days where people where used to check every single return
value for PEAR_Error. The SNMP class is new and could lead as good example for proper OOP style!
(Or do you prefer C style $errno checking after every method call over try/catch statements? The
chances that an error goes unnoticed is much lower with exceptions.)
Previous Comments:
------------------------------------------------------------------------
[2011-09-02 11:48:34] lytboris@php.net
enable SNMP::ERRNO_ANY by default is not a good idea I think. PDO has the same default behavior for
throwing exceptions.
------------------------------------------------------------------------
[2011-09-02 10:41:20] ch@php.net
Thanks for implementing this so quickly. But the constructor still says:
"snmp_object->exceptions_enabled = 0;", as this is a class one would rather expect OOP
style exceptions as default, or?
------------------------------------------------------------------------
[2011-09-02 10:13:21] lytboris@php.net
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
A new SNMP object property is introduced: exceptions_enabled.
Setting this property to ORed combination of SNMP::ERRNO_* errors will enable exception throwing on
these errors. SNMP::ERRNO_ANY may be used to enable all posslible SNMP::ERRNO_* errors at once.
------------------------------------------------------------------------
[2011-09-02 10:13:19] lytboris@php.net
Automatic comment from SVN on behalf of lytboris
Revision: http://svn.php.net/viewvc/?view=revision&revision=316032
Log: merge from trunk
added SNMPException class, enabling ability to throw exceptions
when a known SNMP error has occured
FR #55542
------------------------------------------------------------------------
[2011-09-02 10:04:08] lytboris@php.net
Automatic comment from SVN on behalf of lytboris
Revision: http://svn.php.net/viewvc/?view=revision&revision=316029
Log: added SNMPException class, enabling ability to throw exceptions
when a known SNMP error has occured
FR #55542
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=55542
--
Edit this bug report at https://bugs.php.net/bug.php?id=55542&edit=1
Thread (7 messages)