forked from verdnatura/hedera-web
43 lines
521 B
PHP
43 lines
521 B
PHP
<?php
|
|
|
|
namespace Vn\Web;
|
|
|
|
require_once (__DIR__.'/rest-app.php');
|
|
|
|
/**
|
|
* Base class for rest services.
|
|
**/
|
|
class HttpRequest extends \Vn\Lib\Method
|
|
{
|
|
function listen ()
|
|
{
|
|
try {
|
|
$this->run ();
|
|
}
|
|
catch (SessionExpiredException $e)
|
|
{
|
|
$this->httpError (403);
|
|
}
|
|
catch (BadLoginException $e)
|
|
{
|
|
$this->httpError (401);
|
|
}
|
|
catch (Exception $e)
|
|
{
|
|
$this->httpError (400);
|
|
}
|
|
}
|
|
|
|
function httpError ($code)
|
|
{
|
|
|
|
}
|
|
|
|
function setError ($message, $code)
|
|
{
|
|
http_response_code (400);
|
|
}
|
|
}
|
|
|
|
?>
|