]> git.mxchange.org Git - friendica-addons.git/commitdiff
[advancedcontentfilter] Update HTTPException handling
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 10 Mar 2020 22:44:27 +0000 (18:44 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 10 Mar 2020 22:44:27 +0000 (18:44 -0400)
advancedcontentfilter/advancedcontentfilter.php
advancedcontentfilter/src/middlewares.php

index c92858135c4865794fa657c4ac3b10445acbcdef..7ecfda4e43034a3f5283ee03af70587bdac62302 100644 (file)
@@ -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']])) {
index 53026204cd7fa4e1ca41e29b23b0347869c7615e..dffb93632beb246a068b3abc70e60f35da970f3c 100644 (file)
@@ -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();