namespace OCA\Federation\Middleware;
use OC\HintException;
+use OCA\Federation\Controller\SettingsController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Middleware;
* @return JSONResponse
*/
public function afterException($controller, $methodName, \Exception $exception) {
+ if (($controller instanceof SettingsController) === false) {
+ throw $exception;
+ }
$this->logger->error($exception->getMessage(), ['app' => $this->appName]);
if ($exception instanceof HintException) {
$message = $exception->getHint();
use OC\HintException;
+use OCA\Federation\Controller\SettingsController;
use OCA\Federation\Middleware\AddServerMiddleware;
-use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\IL10N;
use OCP\ILogger;
/** @var AddServerMiddleware */
private $middleware;
- /** @var \PHPUnit_Framework_MockObject_MockObject | Controller */
+ /** @var \PHPUnit_Framework_MockObject_MockObject | SettingsController */
private $controller;
public function setUp() {
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
- $this->controller = $this->getMockBuilder(Controller::class)
+ $this->controller = $this->getMockBuilder(SettingsController::class)
->disableOriginalConstructor()->getMock();
$this->middleware = new AddServerMiddleware(