Assign errMsg value to config object instead of global scope