Browse Source

[advancedcontentfilter] Update HTTPException handling

pull/966/head
Hypolite Petovan 2 years ago
parent
commit
f2772b87c0
  1. 4
      advancedcontentfilter/advancedcontentfilter.php
  2. 2
      advancedcontentfilter/src/middlewares.php

4
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']])) {

2
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();

Loading…
Cancel
Save