Implements the custom error management