mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-25 05:43:41 +00:00
[advancedcontentfilter] Update HTTPException handling
This commit is contained in:
parent
8b17ea90c4
commit
f2772b87c0
2 changed files with 3 additions and 3 deletions
|
@ -330,7 +330,7 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request)
|
||||||
try {
|
try {
|
||||||
$fields = advancedcontentfilter_build_fields($data);
|
$fields = advancedcontentfilter_build_fields($data);
|
||||||
} catch (Exception $e) {
|
} 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'])) {
|
if (empty($fields['name']) || empty($fields['expression'])) {
|
||||||
|
@ -368,7 +368,7 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res
|
||||||
try {
|
try {
|
||||||
$fields = advancedcontentfilter_build_fields($data);
|
$fields = advancedcontentfilter_build_fields($data);
|
||||||
} catch (Exception $e) {
|
} 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']])) {
|
if (!DBA::update('advancedcontentfilter_rules', $fields, ['id' => $args['id']])) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ $container['errorHandler'] = function () {
|
||||||
$responseCode = 500;
|
$responseCode = 500;
|
||||||
|
|
||||||
if (is_a($exception, 'Friendica\Network\HTTPException')) {
|
if (is_a($exception, 'Friendica\Network\HTTPException')) {
|
||||||
$responseCode = $exception->httpcode;
|
$responseCode = $exception->getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
$errors['message'] = $exception->getMessage();
|
$errors['message'] = $exception->getMessage();
|
||||||
|
|
Loading…
Reference in a new issue