kermitt2 / grobid_client_python

Python client for GROBID Web services
Apache License 2.0
275 stars 74 forks source link

Save error results with status as file extension when the status code is not 200 #51

Closed lfoppiano closed 1 year ago

lfoppiano commented 1 year ago

This PR will avoid creating files without a valid response. See issue #50

kermitt2 commented 1 year ago

File creation with error messages was actually done on purposes, as a "convenient" way to get all results. Just looking at the files, it is easy to identify processing errors, given that currently the error messages are written in kilometers on the console, then lost in limbo :)

But it's not the best way to save errors sure, we should add some proper logs.

The error 500 not reported by the client is a bug yes !

lfoppiano commented 1 year ago

File creation with error messages was actually done on purposes, as a "convenient" way to get all results. Just looking at the files, it is easy to identify processing errors, given that currently the error messages are written in kilometers on the console, then lost in limbo :)

How about save them with a different extension (after all, they are not XML) or with a suffix, like the error code? In this way they can be copied / examined easily

kermitt2 commented 1 year ago

How about save them with a different extension (after all, they are not XML) or with a suffix, like the error code? In this way they can be copied / examined easily

good idea ! I think it would be much better yes

lfoppiano commented 1 year ago

I've added that when there is a non-200 error code, the file is still created, with a suffixed error code and extension .txt

kermitt2 commented 1 year ago

Thanks !!