From: Hypolite Petovan Date: Tue, 10 Mar 2020 22:44:27 +0000 (-0400) Subject: [advancedcontentfilter] Update HTTPException handling X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f2772b87c06868424f8e288d8caa48a110afd720;p=friendica-addons.git [advancedcontentfilter] Update HTTPException handling --- diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index c9285813..7ecfda4e 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -330,7 +330,7 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request) try { $fields = advancedcontentfilter_build_fields($data); } catch (Exception $e) { - throw new HTTPException\BadRequestException($e->getMessage(), 0, $e); + throw new HTTPException\BadRequestException($e->getMessage(), $e); } if (empty($fields['name']) || empty($fields['expression'])) { @@ -368,7 +368,7 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res try { $fields = advancedcontentfilter_build_fields($data); } catch (Exception $e) { - throw new HTTPException\BadRequestException($e->getMessage(), 0, $e); + throw new HTTPException\BadRequestException($e->getMessage(), $e); } if (!DBA::update('advancedcontentfilter_rules', $fields, ['id' => $args['id']])) { diff --git a/advancedcontentfilter/src/middlewares.php b/advancedcontentfilter/src/middlewares.php index 53026204..dffb9363 100644 --- a/advancedcontentfilter/src/middlewares.php +++ b/advancedcontentfilter/src/middlewares.php @@ -30,7 +30,7 @@ $container['errorHandler'] = function () { $responseCode = 500; if (is_a($exception, 'Friendica\Network\HTTPException')) { - $responseCode = $exception->httpcode; + $responseCode = $exception->getCode(); } $errors['message'] = $exception->getMessage();