add errormsg support