yii\base\Exception::getName PHP Method

getName() public method

public getName ( ) : string
return string the user-friendly name of this exception
    public function getName()
    {
        return 'Exception';
    }

Usage Example

Beispiel #1
0
 /**
  * Converts an exception into a simple string.
  * @param \Exception $exception the exception being converted
  * @return string the string representation of the exception.
  */
 public static function convertExceptionToString($exception)
 {
     if ($exception instanceof Exception && ($exception instanceof UserException || !YII_DEBUG)) {
         $message = "{$exception->getName()}: {$exception->getMessage()}";
     } elseif (YII_DEBUG) {
         if ($exception instanceof Exception) {
             $message = "Exception ({$exception->getName()})";
         } elseif ($exception instanceof ErrorException) {
             $message = "{$exception->getName()}";
         } else {
             $message = 'Exception';
         }
         $message .= " '" . get_class($exception) . "' with message '{$exception->getMessage()}' \n\nin " . $exception->getFile() . ':' . $exception->getLine() . "\n\n" . "Stack trace:\n" . $exception->getTraceAsString();
     } else {
         $message = 'Error: ' . $exception->getMessage();
     }
     return $message;
 }
All Usage Examples Of yii\base\Exception::getName
Exception