Elastica
Elastica copied to clipboard
Improve error handling of elasticsearch errors
Elasticsearch 2.0 provides a full error object. This must be mapped in a better way.
In Elastica it is still possible to get the Error as a string. This should be improved, tested and cleaned up.
This line is currently more a hack: https://github.com/ruflin/Elastica/commit/99d7cd147c469e20e0c8e550c431712edda4dd19#diff-b364251d02e70310f3c6e443372397d3R104
Could you please also fix ActionException::getErrorMessage()?
$message = "$opType: $path caused $error";
When $error is an array, the message becomes something like 'update: /customer/customer/26210548 caused Array'
@cameronmurphy Could you provide a PR for this fix?
@ruflin https://github.com/ruflin/Elastica/pull/1089
I think this can be closed as there is getFullError
now.
@Tobion My idea here was, that getFullError
does potentially not only return an array, but an object which can be further inspected.
I see, but the errors are nested and the error response structure is not always the same. So it might be hard to find a common object for this.
I never dived into it to see if it is possible. Also not sure if there is a benefit ...