raise error when err = 1