Commando\Command::trapErrors PHP Method

trapErrors() public method

public trapErrors ( boolean $trap = true ) : Command
$trap boolean when true, exceptions will be caught by Commando and printed cleanly to standard error.
return Command
    public function trapErrors($trap = true)
    {
        $this->trap_errors = $trap;
        return $this;
    }

Usage Example

 /**
  * Test that an exception is thrown when an option isn't set
  * @expectedException \InvalidArgumentException
  */
 public function testRequirementsOnOptionsMissing()
 {
     $tokens = array('filename', '-a', 'v1');
     $cmd = new Command($tokens);
     $cmd->trapErrors(false)->beepOnError(false);
     $cmd->option('a')->needs('b');
 }