From 9e1cde4593601f89f132d5df87dd8613f8a6a641 Mon Sep 17 00:00:00 2001 From: Andrew Paxley Date: Mon, 25 Sep 2023 14:53:24 +1300 Subject: [PATCH] ENH additional error codes, tidy translations --- lang/en.yml | 17 +++++++++++++++-- src/ErrorPage.php | 13 +++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lang/en.yml b/lang/en.yml index a49b45c..4532366 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -19,8 +19,16 @@ en: CODE_415: '415 - Unsupported Media Type' CODE_416: '416 - Request Range Not Satisfiable' CODE_417: '417 - Expectation Failed' + CODE_418: "418 - I'm a teapot" + CODE_421: '421 - Misdirected Request' CODE_422: '422 - Unprocessable Entity' + CODE_423: '423 - Locked' + CODE_424: '424 - Failed Dependency' + CODE_425: '425 - Too Early' + CODE_426: '426 - Upgrade Required' + CODE_428: '428 - Precondition Required' CODE_429: '429 - Too Many Requests' + CODE_431: '431 - Request Header Fields Too Large' CODE_451: '451 - Unavailable For Legal Reasons' CODE_500: '500 - Internal Server Error' CODE_501: '501 - Not Implemented' @@ -28,14 +36,19 @@ en: CODE_503: '503 - Service Unavailable' CODE_504: '504 - Gateway Timeout' CODE_505: '505 - HTTP Version Not Supported' + CODE_506: '506 - Variant Also Negotiates' + CODE_507: '507 - Insufficient Storage' + CODE_508: '508 - Loop Detected' + CODE_510: '510 - Not Extended' + CODE_511: '511 - Network Authentication Required' DEFAULTERRORPAGECONTENT: "

Sorry, it seems you were trying to access a page that doesn't exist.

Please check the spelling of the URL you were trying to access and try again.

" DEFAULTERRORPAGETITLE: 'Page not found' DEFAULTSERVERERRORPAGECONTENT: '

Sorry, there was a problem with handling your request.

' DEFAULTSERVERERRORPAGETITLE: 'Server error' DESCRIPTION: 'Custom content for different error cases (e.g. "Page not found")' - PLURALNAME: 'Base Pages' + PLURALNAME: 'Error Pages' PLURALS: one: 'An Error Page' - other: '{count} Base Pages' + other: '{count} Error Pages' SINGULARNAME: 'Error Page' db_ErrorCode: 'Error code' diff --git a/src/ErrorPage.php b/src/ErrorPage.php index 1bc27a6..82314e1 100644 --- a/src/ErrorPage.php +++ b/src/ErrorPage.php @@ -403,8 +403,16 @@ protected function getCodes() 415 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_415', '415 - Unsupported Media Type'), 416 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_416', '416 - Request Range Not Satisfiable'), 417 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_417', '417 - Expectation Failed'), + 418 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_418', "418 - I'm a teapot"), + 421 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_421', '421 - Misdirected Request'), 422 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_422', '422 - Unprocessable Entity'), + 423 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_423', '423 - Locked'), + 424 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_424', '424 - Failed Dependency'), + 425 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_425', '425 - Too Early'), + 426 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_426', '426 - Upgrade Required'), + 428 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_428', '428 - Precondition Required'), 429 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_429', '429 - Too Many Requests'), + 431 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_431', '431 - Request Header Fields Too Large'), 451 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_451', '451 - Unavailable For Legal Reasons'), 500 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_500', '500 - Internal Server Error'), 501 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_501', '501 - Not Implemented'), @@ -412,6 +420,11 @@ protected function getCodes() 503 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_503', '503 - Service Unavailable'), 504 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_504', '504 - Gateway Timeout'), 505 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_505', '505 - HTTP Version Not Supported'), + 506 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_506', '506 - Variant Also Negotiates'), + 507 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_507', '507 - Insufficient Storage'), + 508 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_508', '508 - Loop Detected'), + 510 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_510', '510 - Not Extended'), + 511 => _t('SilverStripe\\ErrorPage\\ErrorPage.CODE_511', '511 - Network Authentication Required'), ]; }