$e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace(), 'previous' => $e->getPrevious(), ] : []; // 添加自定义异常处理机制 if ($e instanceof DbException) { return app('json')->fail('数据获取失败', $massageData); } elseif ($e instanceof AuthException || $e instanceof ValidateException || $e instanceof ApiException || $e instanceof PayException || $e instanceof TemplateException || $e instanceof UploadException || $e instanceof WechatReplyException || $e instanceof AdminException || $e instanceof WechatException ) { return app('json')->make($e->getCode() ?: 400, $e->getMessage(), $massageData); } else { return app('json')->code(500)->make(400, $e->getMessage(), $massageData); } } }