Skip to content

ErrorTask

Methods

setStatusCode

Set the status code for the response. Immediately throw a CliException.

public setStatusCode(int $code = 500, string|null $message = null): \Phalcon\Http\ResponseInterface

Parameters:

Parameter Type Description
$code int The status code to set. Defaults to 500 if not provided.
$message **string null**

Throws:

If an error occurs while setting the status code.


Inherited methods

errorAction

Http Status Code - Generic error

public errorAction(?int $code = null, ?string $message = null): void

Parameters:

Parameter Type Description
$code ?int
$message ?string

badRequestAction

Http Status Code 400 bad-request

public badRequestAction(): void

unauthorizedAction

Http Status Code 401 unauthorized

public unauthorizedAction(): void

forbiddenAction

Http Status Code 403 forbidden

public forbiddenAction(): void

notFoundAction

Http Status Code 404 not-found

public notFoundAction(): void

fatalAction

Http Status Code 500 fatal

public fatalAction(): void

maintenanceAction

Http Status Code 503 maintenance

public maintenanceAction(): void

beforeExecuteRoute

public beforeExecuteRoute(): void

helpAction

public helpAction(): void

mainAction

public mainAction(): ?array

normalizeResponse

public normalizeResponse(bool $response = true, ?int $code = null, ?string $status = null): array

Parameters:

Parameter Type Description
$response bool
$code ?int
$status ?string

afterExecuteRoute

Handle rest response automagically

public afterExecuteRoute(\Phalcon\Cli\Dispatcher $dispatcher): void

Parameters:

Parameter Type Description
$dispatcher \Phalcon\Cli\Dispatcher

Throws: