handling errorcode