made setting err msg a method