Common code collected to own function and API can receive
COM_MSG_ERROR message

Change-Id: I2cfc3a120f9167fa9eebec86563eab8d79169224
Signed-off-by: TanelDettenborn <tanel.dettenborn@intel.com>