1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace App\Exceptions;
- use Exception;
- use Throwable;
- /**
- * 通知发送异常
- * Class NoticeException
- * @package App\Exceptions
- */
- class NoticeException extends Exception
- {
- //
- public function __construct(string $message = "", int $code = 200, Throwable $previous = null)
- {
- parent::__construct($message, $code, $previous);
- }
- /**
- * 将异常渲染到 HTTP 响应中。
- *
- * @param \Illuminate\Http\Request
- * @return void
- */
- public function render($request)
- {
- return response([
- 'code' => $this->getCode(),
- 'error' => $this->getMessage(),
- 'message' => '请求成功,通知失败'
- ]);
- }
- }
|