Open hbruch opened 1 month ago
This is a downstream repetition of an already existing problem. We don't have visibility into parse failures in the loader either. That said, we should definitely catch JSONException in the validator and re-throw a more specific exception.
Some possible solutions:
Assuming that a parsing problem in the validator is subsumed by an equivalent parsing error in the (file-)loader, do we need to distinguish between them? In other words, do we want the validation dto's to carry general information about errors encountered during loading?
Expected behavior
In case a feed is not parsable, e.g. due to malformed json, this should result in a properly logged exception and a metric should reflect this.
Observed behavior
In case of an unparsable JSON,
GbfsJsonValidator.validate
throws an uncatched Exception, which prevents that the delivery is consumed.Version of lamassu used (exact commit hash or JAR name)
https://github.com/entur/lamassu/commit/373e17a1f0ca47a2a2119a5d3d9ab36e47ef3807
Suggested change
IMHO, GbfsJsonValidator.validate() should be changed to record parse exceptions per file als
FileValidationError
.