[advancedcontentfilter] Improve error handling

- Add Logger to Slim application to log to Friendica log file
- Show more specific error message when rule syntax check fails
- Align editorconfig with Composer style
- Add minimum PHP version to composer.json
pull/1487/head
Hypolite Petovan 2024-03-19 22:28:30 -04:00
parent 11cc359434
commit 46c65b79be
4 changed files with 31 additions and 25 deletions

View File

@ -27,3 +27,6 @@ indent_size = 2
[*.json] [*.json]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
[composer.json]
indent_size = 4

View File

@ -54,7 +54,7 @@ new Vue({
self.rules.push(responseJSON.rule); self.rules.push(responseJSON.rule);
self.resetForm(); self.resetForm();
}, function (response) { }, function (response) {
self.errorMessage = response.responseJSON.message; self.errorMessage = response.responseJSON.exception[0].message;
}); });
} }
}, },
@ -74,7 +74,7 @@ new Vue({
self.rules[self.editedIndex] = rule; self.rules[self.editedIndex] = rule;
self.resetForm(); self.resetForm();
}, function (response) { }, function (response) {
self.errorMessage = response.responseJSON.message; self.errorMessage = response.responseJSON.exception[0].message;
}); });
}, },

View File

@ -1,24 +1,27 @@
{ {
"name": "friendica-addons/advancedcontentfilter", "name": "friendica-addons/advancedcontentfilter",
"description": "Advanced Content Filter addon for Friendica", "description": "Advanced Content Filter addon for Friendica",
"type": "friendica-addon", "type": "friendica-addon",
"authors": [ "authors": [
{ {
"name": "Hypolite Petovan", "name": "Hypolite Petovan",
"email": "hypolite@mrpetovan.com", "email": "hypolite@mrpetovan.com",
"homepage": "https://friendica.mrpetovan.com/profile/hypolite", "homepage": "https://friendica.mrpetovan.com/profile/hypolite",
"role": "Developer" "role": "Developer"
} }
], ],
"require": { "require": {
"slim/slim": "^4", "slim/slim": "^4",
"symfony/expression-language": "^3.4" "symfony/expression-language": "^3.4"
}, },
"license": "3-clause BSD license", "license": "3-clause BSD license",
"minimum-stability": "stable", "minimum-stability": "stable",
"config": { "config": {
"optimize-autoloader": true, "platform": {
"autoloader-suffix": "AdvancedContentFilterAddon", "php": "7.4"
"preferred-install": "dist" },
} "optimize-autoloader": true,
"autoloader-suffix": "AdvancedContentFilterAddon",
"preferred-install": "dist"
}
} }

View File

@ -29,4 +29,4 @@ use Friendica\DI;
*/ */
$slim->addRoutingMiddleware(); $slim->addRoutingMiddleware();
$errorMiddleware = $slim->addErrorMiddleware(true, true, true); $errorMiddleware = $slim->addErrorMiddleware(true, true, true, DI::logger());