getError(),[], $e->getCode()); //数据库错误 if($e instanceof PDOException) return JsonService::fail($e->getMessage(),[],$e->getCode()); //Db错误 if($e instanceof DbException) return JsonService::fail($e->getMessage(),[],$e->getCode()); //HTTP相应错误 if($e instanceof HttpException) return JsonService::fail($e->getMessage(),[],$e->getCode()); //其他错误异常 if($e instanceof ErrorException) return JsonService::fail($e->getMessage(),[],$e->getCode()); //默认错误提示 $baseExcep=new BaseException(); return JsonService::fail($baseExcep->msg,[],$baseExcep->code); } }