awslabs/benchmark-ai

[bff] Bubble up schema validation error to customer

Aberta

#950 aberto em 15 de out. de 2019

 (0 comentário) (0 reação) (0 responsável)Python (6 forks)auto 404
enhancementgood first issue

Métricas do repositório

Stars
 (19 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

If there is a "TOML" schema validation error the user does not get an informative error message. What they get is:

[ERROR] Submission was NOT successful - submission rejected by service:
{"status":400,"headers":{},"body":"Could Not Parse Submitted Descriptor: JSON Validation error:"}

The validation takes place here, and thus the genesis of this exception https://github.com/awslabs/benchmark-ai/blob/master/bai-bff/src/bai_bff/events.clj#L45

What it really looks like is:

Execution error (ValidationException) at org.everit.json.schema.ValidationException/prepend (ValidationException.java:395).
#/ml/args: expected type: JSONArray, found: String

So the task here is to expose that exception's details through the bubbled up exception, "handled" in the calling environment: https://github.com/awslabs/benchmark-ai/blob/master/bai-bff/src/bai_bff/http_api.clj#L38

Guia do colaborador