当前位置: 首页>>代码示例>>PHP>>正文


PHP Error::getMessage方法代码示例

本文整理汇总了PHP中Error::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::getMessage方法的具体用法?PHP Error::getMessage怎么用?PHP Error::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error::getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getErrorMessage

 /**
  * @return null|string
  */
 public function getErrorMessage()
 {
     if ($this->error instanceof Error) {
         return $this->error->getMessage();
     }
     return null;
 }
开发者ID:igaponov,项目名称:jsonrpc,代码行数:10,代码来源:Response.php

示例2: post

 protected function post($mode = "", $id = null, $title = "", $description = "", $media = "")
 {
     //validations
     if ($mode != "delete") {
         if (!(is_numeric($id) && $id > 0)) {
             throw new RestException("99", "ID no es valido");
         }
         if (empty($title)) {
             throw new RestException("99", "Titulo no puede ir vacio");
         }
     } else {
         if (!(is_numeric($id) && $id > 0)) {
             throw new RestException("99", "ID no es valido");
         }
     }
     switch ($mode) {
         case "edit":
             return $this->dp->update($id, $title, $description, $media);
             break;
         case "delete":
             return $this->dp->delete($id);
             break;
         case "add":
             return $this->dp->insert($id, $title, $description, $media);
             break;
     }
     Error::getMessage(304);
 }
开发者ID:robextrem,项目名称:testgrid,代码行数:28,代码来源:article.php

示例3: testBasic

 public function testBasic()
 {
     $error = new Error('error', 1);
     $this->assertSame('error', (string) $error);
     $this->assertSame('error', $error->getMessage());
     $this->assertSame(1, $error->getCode());
 }
开发者ID:messyOne,项目名称:Loo-Framework,代码行数:7,代码来源:ErrorTest.php

示例4: testUnknownLine

 public function testUnknownLine()
 {
     $error = new Error('Some error');
     $this->assertSame(-1, $error->getStartLine());
     $this->assertSame(-1, $error->getEndLine());
     $this->assertSame('Some error on unknown line', $error->getMessage());
 }
开发者ID:nikic,项目名称:php-parser,代码行数:7,代码来源:ErrorTest.php

示例5: __construct

 /**
  * Wraps the passed Error class
  *
  * @param Error $error the Error object
  */
 public function __construct($error)
 {
     $this->_error = $error;
     $message = $error->getMessage();
     $code = $error->getCode();
     parent::__construct(sprintf('(%s) - %s', get_class($error), $message), $code);
 }
开发者ID:rederlo,项目名称:cakephp,代码行数:12,代码来源:PHP7ErrorException.php

示例6: formatErrorMessage

 private function formatErrorMessage(Error $e, $code)
 {
     if ($e->hasColumnInfo()) {
         return $e->getMessageWithColumnInfo($code);
     } else {
         return $e->getMessage();
     }
 }
开发者ID:nikic,项目名称:php-parser,代码行数:8,代码来源:CodeParsingTest.php

示例7: formatErrorMessage

 private function formatErrorMessage(Error $e, $code)
 {
     if ($e->hasColumnInfo()) {
         return $e->getRawMessage() . ' from ' . $e->getStartLine() . ':' . $e->getStartColumn($code) . ' to ' . $e->getEndLine() . ':' . $e->getEndColumn($code);
     } else {
         return $e->getMessage();
     }
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:8,代码来源:CodeParsingTest.php

示例8: fromError

 /**
  * 
  * @param \webignition\CssValidatorOutput\Message\Error $error
  * @return \webignition\CssValidatorOutput\Message\Warning
  */
 public static function fromError(Error $error)
 {
     $warning = new Warning();
     $warning->setContext($error->getContext());
     $warning->setLineNumber($error->getLineNumber());
     $warning->setMessage($error->getMessage());
     $warning->setRef($error->getRef());
     return $warning;
 }
开发者ID:webignition,项目名称:css-validator-output-parser,代码行数:14,代码来源:Warning.php

示例9: handleException

/**
 * @param Exception | Error $e
 */
function handleException($e)
{
    $request = \OC::$server->getRequest();
    // in case the request content type is text/xml - we assume it's a WebDAV request
    $isXmlContentType = strpos($request->getHeader('Content-Type'), 'text/xml');
    if ($isXmlContentType === 0) {
        // fire up a simple server to properly process the exception
        $server = new Server();
        if (!$e instanceof RemoteException) {
            // we shall not log on RemoteException
            $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
        }
        $server->on('beforeMethod', function () use($e) {
            if ($e instanceof RemoteException) {
                switch ($e->getCode()) {
                    case OC_Response::STATUS_SERVICE_UNAVAILABLE:
                        throw new ServiceUnavailable($e->getMessage());
                    case OC_Response::STATUS_NOT_FOUND:
                        throw new \Sabre\DAV\Exception\NotFound($e->getMessage());
                }
            }
            $class = get_class($e);
            $msg = $e->getMessage();
            throw new ServiceUnavailable("{$class}: {$msg}");
        });
        $server->exec();
    } else {
        $statusCode = OC_Response::STATUS_INTERNAL_SERVER_ERROR;
        if ($e instanceof \OC\ServiceUnavailableException) {
            $statusCode = OC_Response::STATUS_SERVICE_UNAVAILABLE;
        }
        if ($e instanceof RemoteException) {
            // we shall not log on RemoteException
            OC_Response::setStatus($e->getCode());
            OC_Template::printErrorPage($e->getMessage());
        } else {
            \OC::$server->getLogger()->logException($e, ['app' => 'remote']);
            OC_Response::setStatus($statusCode);
            OC_Template::printExceptionErrorPage($e);
        }
    }
}
开发者ID:GitHubUser4234,项目名称:core,代码行数:45,代码来源:remote.php

示例10: test

 public function test()
 {
     $error = new Error(E_ERROR, 'message', 'file', 0);
     $this->assertSame(E_ERROR, $error->getSeverity());
     $this->assertSame('message', $error->getMessage());
     $this->assertSame('Fatal error', $error->getSeverityAsString());
     $this->assertSame('E_ERROR', $error->getSeverityAsConstantName());
     $this->assertSame('file', $error->getFile());
     $this->assertSame(0, $error->getLine());
     $this->assertSame('Fatal error:  message in file on line 0', (string) $error);
 }
开发者ID:hyperframework,项目名称:hyperframework,代码行数:11,代码来源:ErrorTest.php

示例11: error

 /**
  * Set error response
  * @param \Sonic\Controller\Error|integer|string $message Error message object, error code or message string
  * @param integer $code Error code, only used if message is a string
  * @param integer $httpCode HTTP status code
  * @return FALSE
  */
 protected function error($message = 'invalid request', $code = 0, $httpCode = 0)
 {
     if (is_numeric($message)) {
         $error = new Error($message);
         $code = $error->getCode();
         $message = $error->getMessage();
     } else {
         if ($message instanceof Error) {
             $code = $message->getCode();
             $message = $message->getMessage();
         }
     }
     $this->view->response = array('success' => 0, 'error_code' => $code, 'error_description' => $message);
     if ($httpCode) {
         $this->httpStatus($httpCode);
     }
     return FALSE;
 }
开发者ID:andyburton,项目名称:sonic-framework,代码行数:25,代码来源:JSON.php

示例12: logError

 /**
  * log error to configured log facility
  *
  * @param Error $error the error
  *
  * @return bool
  *
  * @todo finish!
  */
 protected function logError($error)
 {
     return error_log($error->getMessage());
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:13,代码来源:ErrorHandler.php

示例13: __construct

 public function __construct(Error $error)
 {
     parent::__construct($error->getMessage() ? $error->getMessage() : '');
     $this->error = $error;
 }
开发者ID:InfinityCCS,项目名称:stormpath-sdk-php,代码行数:5,代码来源:ResourceError.php

示例14: testValidMessage

 public function testValidMessage()
 {
     $errorMessage = 'This is an error message';
     $error = new Error($errorMessage);
     $this->assertEquals($errorMessage, $error->getMessage());
 }
开发者ID:php-ddd,项目名称:notification,代码行数:6,代码来源:ErrorTest.php

示例15: testGetMessage

 public function testGetMessage()
 {
     $this->assertEquals('error_message', $this->error->getMessage());
 }
开发者ID:neeckeloo,项目名称:ClosureCompilerPHP,代码行数:4,代码来源:ErrorTest.php


注:本文中的Error::getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。