refactory error message