Adding global listener for errors

This function will be called whenever a Deferred is ending in "fail".

Related to suggestion #54.