dlr-eoc / prosEO

prosEO – A Processing System for Earth Observation Data
GNU General Public License v3.0
14 stars 1 forks source link

CLI: Print well-formed error messages from called process instead of generic message #105

Closed tangobravo62 closed 3 years ago

tangobravo62 commented 3 years ago

Currently when receiving a 400 BAD REQUEST status, the CLI wraps the content of the "Warning:" header in a generic error message:

prosEO (NM4T)> processor class update NM4T_ProcessorClass_1 productClasses=L2________
(E2806) Command failed (cause: org.springframework.web.client.HttpClientErrorException$BadRequest: 400 199 proseo-processor-mgr (E2205) Product type L2________ invalid for mission NM4T)

It would be nicer, if the CLI parsed the message and just returned the inner message, if the "Warning:" header was well-formed (according to the HTTP protocol definition 199 <sender> <message> and the prosEO convention for the message (<message code>) <message text>). For the case above, the output would then just be:

(E2205) Product type L2________ invalid for mission NM4T
tangobravo62 commented 3 years ago

Fixed with commit 404e45f.

prosEO-compliant messages are now extracted from the "Warning" header:

prosEO (PTM)> processor update --file=testproc.json
(E2987) Processor data invalid (cause: (E2268) Task ptm_l2 defined as critical, but no criticality level given)