Process error messages correctly