This commit is contained in:
2021-03-09 10:24:04 +08:00
parent 098b33c672
commit c92bc22782
+2 -1
View File
@@ -10,6 +10,7 @@ use HttpServer\Exception\ExitException;
use HttpServer\Http\Request as HRequest;
use HttpServer\Http\Response as HResponse;
use ReflectionException;
use Snowflake\Core\Json;
use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\NotFindClassException;
@@ -47,7 +48,7 @@ class OnRequest extends Callback
return \send(null);
} catch (ExitException | Error | \Throwable $exception) {
if ($exception instanceof ExitException) {
return \send($exception->getMessage(), $exception->getCode());
return \send(Json::to($exception->getCode(), $exception->getMessage()));
}
return $this->sendErrorMessage($request, $response, $exception);
}