Add logging for errorCode