ruflin / Elastica

Elastica is a PHP client for elasticsearch
http://elastica.io/
MIT License
2.26k stars 734 forks source link

Improve error handling of elasticsearch errors #1019

Open ruflin opened 8 years ago

ruflin commented 8 years ago

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

cameronmurphy commented 8 years ago

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'

ruflin commented 8 years ago

@cameronmurphy Could you provide a PR for this fix?

cameronmurphy commented 8 years ago

@ruflin https://github.com/ruflin/Elastica/pull/1089

Tobion commented 7 years ago

I think this can be closed as there is getFullError now.

ruflin commented 7 years ago

@Tobion My idea here was, that getFullError does potentially not only return an array, but an object which can be further inspected.

Tobion commented 7 years ago

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.

ruflin commented 7 years ago

I never dived into it to see if it is possible. Also not sure if there is a benefit ...