Most extensions to Grind should be done via Providers, however there are several core classes that are created immediately upon instantiating Grind that need to be treated differently.
For these classes, you can pass in an object when creating an instance of Grind
in app/Boostrap.js
:
const app =errorHandlerClass: ErrorHandler
Grind will now use the provided ErrorHandler
class instead of the default one it ships with.
Here’s a list of available overrides:
Class Name | Constructor Key | Reference |
---|---|---|
Router |
routerClass |
Router.js |
ErrorHandler |
errorHandlerClass |
ErrorHandler.js |
Config |
configClass |
Config.js |
UrlGenerator |
urlGeneratorClass |
UrlGenerator.js |
Paths |
pathsClass |
Paths.js |
grind-framework
exports all of the above classes for you to subclass and extend.
Here’s an example overriding the ErrorHandler class to report errors to a collector API:
Edit{return}