From f2772b87c06868424f8e288d8caa48a110afd720 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 10 Mar 2020 18:44:27 -0400 Subject: [PATCH] [advancedcontentfilter] Update HTTPException handling --- advancedcontentfilter/advancedcontentfilter.php | 4 ++-- advancedcontentfilter/src/middlewares.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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(); -- 2.39.5