Add namepace for function when-err. Fixes compilation error.

This namespace was refusing to compile. Added namespace for the function when-err, fixed.