/**
  * Make a new API Exception with the given result.
  *
  * @param array $result The result from the API server
  */
 public function __construct($result)
 {
     $this->result = $result;
     $code = isset($result['error_code']) ? $result['error_code'] : 0;
     if (isset($result['error_description'])) {
         // OAuth 2.0 Draft 10 style
         $msg = $result['error_description'];
     } else {
         if (isset($result['error']) && is_array($result['error'])) {
             // OAuth 2.0 Draft 00 style
             $msg = $result['error']['message'];
         } else {
             if (isset($result['error_msg'])) {
                 // Rest server style
                 $msg = $result['error_msg'];
             } else {
                 $msg = 'Unknown Error. Check getResult()';
             }
         }
     }
     parent::__construct($msg, $code);
 }
Example #2
0
 public function __construct($msg)
 {
     \Log::error($msg);
     parent::__construct($msg);
 }