Throw a custom error when parsing invalid input.