Remove leading/trailing spaces from error messages