PHPackages                             jonom/silverstripe-custom-errors - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jonom/silverstripe-custom-errors

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

jonom/silverstripe-custom-errors
================================

Themed custom error responses for SilverStripe CMS

1.0.6(10mo ago)36111[1 issues](https://github.com/jonom/silverstripe-custom-errors/issues)MITPHP

Since Jun 6Pushed 10mo ago2 watchersCompare

[ Source](https://github.com/jonom/silverstripe-custom-errors)[ Packagist](https://packagist.org/packages/jonom/silverstripe-custom-errors)[ Fund](https://www.paypal.me/jmnz)[ GitHub Sponsors](https://github.com/jonom)[ RSS](/packages/jonom-silverstripe-custom-errors/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (1)Versions (8)Used By (0)

SilverStripe Custom Errors Module
=================================

[](#silverstripe-custom-errors-module)

Overview
--------

[](#overview)

As an alternative to the Error Page module, this module provides themed error responses but makes developers responsible for the content of error messages instead of CMS users.

Installation
------------

[](#installation)

```
$ composer require jonom/silverstripe-custom-errors

```

Configuration
-------------

[](#configuration)

You can define default response content for each response code through the yml config API. Response codes need to be prefixed with the letter 'e' because numbers alone aren't valid SS config keys. Fields you specify will be passed through to a page template for rendering. You can specify a value only, or cast a value by specifying details in an arrray. Example:

```
---
Name: my-custom-errors
After:
    - '#custom-errors'
---
JonoM\CustomErrors\CustomErrorControllerExtension:
  custom_fields:
    default:
      Content:
        Type: 'SilverStripe\ORM\FieldType\DBHTMLText'
        Value: 'Sorry, there was a problem with handling your request.'
    e404:
      Title: 'Not Found'
      Content:
        Type: 'SilverStripe\ORM\FieldType\DBHTMLText'
        Value: '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.'
```

You can also specify a default controller and template for error responses.

```
JonoM\CustomErrors\CustomErrorControllerExtension:
  default_controller: 'PageController'
  default_template: 'Page' # exclude .ss extension
```

Custom error responses
----------------------

[](#custom-error-responses)

You can call `$this->httpError($statusCode, $errorMessage)` from your controller and get a themed response, but if default content has been provided for the given status code, your `$errorMessage` won't be displayed. This is to ensure that you have some control over all of the error messages that a user may see, not just the ones that are triggered in your own code.

To return a custom error response from a controller, instead of calling `$this->httpError()` you can use `$this->customError()` and pass through custom fields the same way you would if using `renderWith()`. Example:

```
if ($somethingWentWrong) {
    $this->customError(404, [
        'Title' => 'We couldn\'t find the droids you are looking for',
        'Content' => DBField::create_field('HTMLText', 'Please try another Cantina')
    ]);
}
```

Any fields you specify are merged with the defaults, so you only need to specify fields that you want to override.

```
$this->customError(404, [
    'Content' => DBField::create_field('HTMLText', 'Maybe try the Google')
]);
```

You can also specify a controller and template to be used.

```
$this->customError(
    404,
    [
        'Content' => DBField::create_field('HTMLText', 'Here are some other droids you may be interested in:'),
        'Droids' => Droid::get()->filterAny(['Language' => 'Beeps', 'Color' => 'Gold'])->limit(5)
    ],
    'DroidHolder',
    'DroidHolderController'
);
```

Maintainer contact
------------------

[](#maintainer-contact)

[Jono Menz](https://jonomenz.com)

Sponsorship
-----------

[](#sponsorship)

If you want to boost morale of the maintainer you're welcome to make a small monthly donation through [**GitHub**](https://github.com/sponsors/jonom), or a one time donation through [**PayPal**](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z5HEZREZSKA6A). ❤️ Thank you!

Please also feel free to [get in touch](https://jonomenz.com) if you want to hire the maintainer to develop a new feature, or discuss another opportunity.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance48

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~432 days

Recently: every ~639 days

Total

7

Last Release

304d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54ba1a57c516be631e90bac916e1add4a84fe2b39284aa5a5cc5ea37c0d6cefa?d=identicon)[Jono M](/maintainers/Jono%20M)

---

Top Contributors

[![jonom](https://avatars.githubusercontent.com/u/1079425?v=4)](https://github.com/jonom "jonom (7 commits)")[![davejtoews](https://avatars.githubusercontent.com/u/9664035?v=4)](https://github.com/davejtoews "davejtoews (1 commits)")

---

Tags

errorsilverstripeerrorpage

### Embed Badge

![Health badge](/badges/jonom-silverstripe-custom-errors/health.svg)

```
[![Health](https://phpackages.com/badges/jonom-silverstripe-custom-errors/health.svg)](https://phpackages.com/packages/jonom-silverstripe-custom-errors)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
