Adding proper error to protocol error handlers