<?php

namespace App\Services\QQMiniApp;

use Exception;
use Illuminate\Http\Response;
use Throwable;

class QQException extends Exception
{


    public function __construct(string $message = "QQ请求失败", int $code = 500, Throwable $previous = null)
    {
        parent::__construct($message, $code, $previous);
    }


    /**
     * 将异常渲染到 HTTP 响应中。
     *
     * @param  \Illuminate\Http\Request $request
     * @return Response
     */
    public function render($request)
    {
        return response([
            'code' => 500,
            'status_code' => 500,
            'error_code' => $this->getCode(),
            'message' => $this->getMessage(),
        ]);
    }
}
