fromException() 공개 정적인 메소드

Convert any exception into a SimpleSAML_Error_Exception.
public static fromException ( Exception $e ) : SimpleSAML_Error_Exception
$e Exception The exception.
리턴 SimpleSAML_Error_Exception The new exception.
예제 #1
0
 /**
  * Constructor for this error.
  *
  * Note that the cause will be converted to a SimpleSAML_Error_UnserializableException unless it is a subclass of
  * SimpleSAML_Error_Exception.
  *
  * @param string         $message Exception message
  * @param int            $code Error code
  * @param Exception|null $cause The cause of this exception.
  */
 public function __construct($message, $code = 0, Exception $cause = null)
 {
     assert('is_string($message)');
     assert('is_int($code)');
     parent::__construct($message, $code);
     $this->initBacktrace($this);
     if ($cause !== null) {
         $this->cause = SimpleSAML_Error_Exception::fromException($cause);
     }
 }
예제 #2
0
                $source['blacklist'] = $blacklist;
            }
            # Merge global and src specific whitelists
            if (isset($source['whitelist'])) {
                $source['whitelist'] = array_unique(array_merge($source['whitelist'], $whitelist));
            } else {
                $source['whitelist'] = $whitelist;
            }
            SimpleSAML_Logger::debug('[metarefresh]: In set [' . $setkey . '] loading source [' . $source['src'] . ']');
            $metaloader->loadSource($source);
        }
        $outputDir = $set->getString('outputDir');
        $outputDir = $config->resolvePath($outputDir);
        $outputFormat = $set->getValueValidate('outputFormat', array('flatfile', 'serialize'), 'flatfile');
        switch ($outputFormat) {
            case 'flatfile':
                $metaloader->writeMetadataFiles($outputDir);
                break;
            case 'serialize':
                $metaloader->writeMetadataSerialize($outputDir);
                break;
        }
    } catch (Exception $e) {
        $e = SimpleSAML_Error_Exception::fromException($e);
        $e->logWarning();
    }
}
$logentries = SimpleSAML_Logger::getCapturedLog();
$t = new SimpleSAML_XHTML_Template($config, 'metarefresh:fetch.tpl.php');
$t->data['logentries'] = $logentries;
$t->show();