Add callbacks to manage errors.
Publish 1.2.1: add callbacks to manage errors.