Adds support for whenError