error handling just like what we did in v2.1

Change-Id: Ice2dddd704db942f134f6c74656999faebde3d16