add better before_process return management and enhance error handling with custom proc in config