Code Sample, a copy-pastable example if possible

>>> pd.to_datetime("00:01:18", format='H%:M%:S%', errors='coerce', infer_datetime_format=False)
"00:01:18"

Problem description

In this example code I have made a mistake with the format 'H%:M%:S%' it should be '%H:%M:%S' instead. Since I have specified errors to 'coerce' getting a string as the return value here seems very surprising to me.

Expected Output

Given that I have specified errors='coerce' and infer_datetime_format=False I'd expect to get a NaT result here.

Output of pd.show_versions()

[paste the output of ``pd.show_versions()`` here below this line] INSTALLED VERSIONS ------------------ commit: None python: 3.7.2.final.0 python-bits: 64 OS: Linux OS-release: 4.15.0-1031-aws machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: C.UTF-8 LOCALE: en_US.UTF-8 pandas: 0.23.4 pytest: 3.8.0 pip: 18.1 setuptools: 40.2.0 Cython: 0.28.5 numpy: 1.15.1 scipy: 1.1.0 pyarrow: None xarray: None IPython: 6.5.0 sphinx: 1.7.9 patsy: 0.5.0 dateutil: 2.7.3 pytz: 2018.5 blosc: None bottleneck: 1.2.1 tables: 3.4.4 numexpr: 2.6.8 feather: None matplotlib: 2.2.3 openpyxl: 2.5.6 xlrd: 1.1.0 xlwt: 1.3.0 xlsxwriter: 1.1.0 lxml: 4.2.5 bs4: 4.6.3 html5lib: 1.0.1 sqlalchemy: 1.2.11 pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None

Comment From: MarcoGorelli

I think this should just raise - errors controls invalid parsing, whereas here the error happens before the parsing even begins