mirror of
https://github.com/chylex/Nextcloud-News.git
synced 2025-08-17 00:31:42 +02:00
.github
.tx
appinfo
bin
css
docs
img
js
l10n
lib
AppInfo
Command
Config
Controller
AdminController.php
ApiController.php
ApiPayloadTrait.php
EntityApiSerializer.php
ExportController.php
FeedApiController.php
FeedController.php
FolderApiController.php
FolderController.php
ItemApiController.php
ItemController.php
JSONHttpErrorTrait.php
PageController.php
UtilityApiController.php
Cron
Db
DependencyInjection
Explore
Fetcher
Hooks
Migration
Plugin
Scraper
Service
Settings
Utility
screenshots
templates
tests
.editorconfig
.gitignore
.mailmap
.travis.yml
AUTHORS.md
CHANGELOG.md
CONTRIBUTING.md
COPYING
Makefile
README.md
composer.json
composer.lock
phpstan.neon.dist
phpunit.integration.xml
phpunit.xml
28 lines
661 B
PHP
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);
|
|
}
|
|
}
|