Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #9341 Exception causes are strings
Submitted: 2006-11-15 16:22 UTC
From: cweiske Assigned: itrebal
Status: Closed Package: Net_MPD (version 0.2.0dev)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    

 [2006-11-15 16:22 UTC] cweiske (Christian Weiske)
Description: ------------ When Net_MPD throws an exception, the exception cause is a string instead of an array. This way you cannot determine the real reason of the failure programmatically, since all you get is a string. Btw, you might be interested that I made a PHP-Gtk2 frontend for mpd using this package: Test script: --------------- <?php require_once 'MPD.php'; $pb = Net_MPD::factory('Playback'); $pb->playId(9999999); ?> Expected result: ---------------- Having the method to get back the real array, e.g. with getErrorData() Actual result: -------------- Fatal error: Uncaught PEAR_Exception: Command failed: Array ( [0] => ACK [50@0] {playid} song id doesn't exist: "9999999" [1] => 50 [2] => 0 [3] => playid [4] => song id doesn't exist: "9999999" )


 [2006-11-21 22:10 UTC] itrebal (Graham Christensen)
Fixed in CVS.
 [2006-11-21 22:11 UTC] itrebal (Graham Christensen)
Sorry, wrong bug - opened again.
 [2006-11-22 00:03 UTC] itrebal (Graham Christensen)
What would the best format be of the array? I'm thinking Array ( [ack] => 50 [func] => playid [error] => song id doesn't exist: "9999999" ) the 'ack' key is specific to the error message, and that can be programmatically checked. The 'error' and 'func' would just be for debugging. How does that look?
 [2006-11-22 00:05 UTC] itrebal (Graham Christensen)
Also: a new constant, 'ACK_COMMAND_FAILED' would be added. For the moment I'm going to make these changes and stick it into CVS.