catch processor/pipeline factory exceptions and return structured error responses#16276
Conversation
There was a problem hiding this comment.
maybe SimulatePipelineResponse can just hold a PipelineFactoryError field? Then this would work and be simple?
There was a problem hiding this comment.
yeah, that would work. I don't know why, but yesterday I felt like having this field that is not always applicable to be really confusing. but it would definitely work and be less refactoring
3a84221 to
79f3632
Compare
There was a problem hiding this comment.
we should include e here, otherwise we lose the cause of the configuration error.
There was a problem hiding this comment.
will add e.getMessage() to the string, good catch!
5cb3dc9 to
200674b
Compare
There was a problem hiding this comment.
maybe rename to validatePipelineResponse?
There was a problem hiding this comment.
sure, I'll update to that. still feels like a weird method in general... but it works
|
Left two small comments. OTT LGTM |
0a4a3af to
5ac974e
Compare
5ac974e to
ed4a8ea
Compare
When there is an exception thrown during pipeline creation within Rest calls (in put pipeline, and simulate) We now return a structured error response to the user with details around which processor's configuration is the cause of the issue, or which configuration property is misconfigured, etc.
ed4a8ea to
fca442f
Compare
catch processor/pipeline factory exceptions and return structured error responses
|
@talevy @martijnvg I think this PR should be reverted and we should use out existing exception infrastructure for this. You can set headers on all ElasticsearchExceptions that get's rendered in a strucutred way. There is no reason to add so much custom code we have a streamlined way to do this. you can just do something like this: try {
// configure
} catch (Exception ex) {
ElasticsearchException e = new ElasticsearchException("failed to configure pipeline", ex);
e.addHeader("processor", "grok");
e.addHeader("what_have_you", "boom");
throw e;
}this will get rendered as: {
"type" : "exception",
"reason" : "failed to configure pipeline",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "something is wrong"
},
"header" : {
"what_have_you" : "boom",
"processor" : "grok"
}
} |
|
interesting, I was not familiar with this do we want to do this. shall I preserve the |
Discussed this we only throw |
|
@martijnvg I think |
|
oh and @talevy @martijnvg by reverting I mean not back it out just use the existing mechanism. :) thanks |
Agreed |
|
confirming here that I am working on migrating to |
|
PR for this fix can be found here: #16355 |
fixes: #16010