How to register an error?