1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00
appwrite/src/Appwrite/Utopia/Response/Model/Error.php
2022-05-23 14:54:50 +00:00

60 lines
1.4 KiB
PHP

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class Error extends Model
{
public function __construct()
{
$this
->addRule('message', [
'type' => self::TYPE_STRING,
'description' => 'Error message.',
'default' => '',
'example' => 'Not found',
])
->addRule('code', [
'type' => self::TYPE_STRING,
'description' => 'Error code.',
'default' => '',
'example' => '404',
])
->addRule('type', [
'type' => self::TYPE_STRING,
'description' => 'Error type. You can learn more about all the error types at https://appwrite.io/docs/error-codes#errorTypes',
'default' => 'unknown',
'example' => 'not_found',
])
->addRule('version', [
'type' => self::TYPE_STRING,
'description' => 'Server version number.',
'default' => '',
'example' => '1.0',
])
;
}
/**
* Get Name
*
* @return string
*/
public function getName(): string
{
return 'Error';
}
/**
* Get Type
*
* @return string
*/
public function getType(): string
{
return Response::MODEL_ERROR;
}
}