1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-04-29 13:34:11 +02:00
Nextcloud-News/lib/Controller/JSONHttpErrorTrait.php
Sean Molenaar 35b53ecd40 OPML export command and fixes
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
2020-09-29 14:56:07 +02:00

28 lines
661 B
PHP

<?php
/**
* Nextcloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
namespace OCA\News\Controller;
use \OCP\AppFramework\Http\JSONResponse;
trait JSONHttpErrorTrait
{
/**
* @param \Exception $exception The exception to report
* @param int $code The http error code
* @return JSONResponse
*/
public function error(\Exception $exception, int $code)
{
return new JSONResponse(['message' => $exception->getMessage()], $code);
}
}