dlr-eoc / prosEO

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

CLI: Parse well-formatted error messages from called processes #106

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

Implemented for 401/403 (NOT AUTHORIZED/FORBIDDEN) with commit 89b8781 Implemented for 400 (BAD REQUEST) with commit 404e45f

tangobravo62 commented 3 years ago

Actually a duplicate of #105