remove trailing whitespace from error message