class ErrorPage extends Page

ErrorPage holds the content for the page of an error response.

Renders the page on each publish action into a static HTML file within the assets directory, after the naming convention /assets/error-.html. This enables us to show errors even if PHP experiences a recoverable error. ErrorPages

Config options

enable_static_file bool Allows control over writing directly to the configured GeneratedAssetStore.
store_filepath string Prefix for storing error files in the {see GeneratedAssetHandler} store.

Properties

int $ErrorCode HTTP Error code

Methods

boolean
canAddChildren($member = null)

No description

static HTTPResponse
response_for(int $statusCode, string|null $errorMessage = null)

Get a {@link HTTPResponse} to response to a HTTP error code if an {@link ErrorPage} for that code is present. First tries to serve it through the standard SilverStripe request method. Falls back to a static file generated when the user hit's save and publish in the CMS

requireDefaultRecords()

Ensures that there is always a 404 page by checking if there's an instance of ErrorPage with a 404 and 500 error code. If there is not, one is created when the DB is built.

getCMSFields()

No description

bool
publishSingle()

When an error page is published, create a static HTML page with its content, so the page can be shown even when SilverStripe is not functioning correctly before publishing this page normally.

true
writeStaticPage()

Write out the published version of the page to the filesystem.

array
fieldLabels(boolean $includerelations = true)

No description

static string|null
get_content_for_errorcode(int $statusCode)

Returns statically cached content for a given error code

Details

at line 87
boolean canAddChildren($member = null)

Parameters

$member

Return Value

boolean

at line 102
static HTTPResponse response_for(int $statusCode, string|null $errorMessage = null)

Get a {@link HTTPResponse} to response to a HTTP error code if an {@link ErrorPage} for that code is present. First tries to serve it through the standard SilverStripe request method. Falls back to a static file generated when the user hit's save and publish in the CMS

Parameters

int $statusCode
string|null $errorMessage A developer message to put in the response on dev envs

Return Value

HTTPResponse

at line 152
requireDefaultRecords()

Ensures that there is always a 404 page by checking if there's an instance of ErrorPage with a 404 and 500 error code. If there is not, one is created when the DB is built.

at line 248
FieldList getCMSFields()

Return Value

FieldList

at line 272
bool publishSingle()

When an error page is published, create a static HTML page with its content, so the page can be shown even when SilverStripe is not functioning correctly before publishing this page normally.

Return Value

bool True if published

at line 303
true writeStaticPage()

Write out the published version of the page to the filesystem.

Return Value

true if the page write was successful

at line 348
array fieldLabels(boolean $includerelations = true)

Parameters

boolean $includerelations a boolean value to indicate if the labels returned include relation fields

Return Value

array

at line 362
static string|null get_content_for_errorcode(int $statusCode)

Returns statically cached content for a given error code

Parameters

int $statusCode A HTTP Statuscode, typically 404 or 500

Return Value

string|null