Just dropping quickly here, and wanting to share a little and yet important part of software development, in web or in any platform.
I believe it is always nice to have a property in your object (or class) to hold the latest error encountered or latest command executed. Sort of like this
class test1 { var $last_error; var $last_cmd; // some other properties here function test1() { // other codes here } /** * the "why" for this class */ function execute() { $command = $this->get_command(); $this->last_cmd = $command; system($command, $res); if ($res) { $this->last_error = $res; return false; } return true; } }
I realize the need for these two properties when I was debugging the CMS I was working on. It involved GraphicsMagick to process resizing, cropping and sharpening image, and executed thru PHP exec or system functions. I forgot why I arrived at using exec over the other. What I did was include these two properties in the log thru a logger method of another class in the system, which indeed, helped me get back to my sanity
.