Elastica icon indicating copy to clipboard operation
Elastica copied to clipboard

Improve error handling of elasticsearch errors

Open ruflin opened this issue 9 years ago • 7 comments

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

ruflin avatar Jan 04 '16 12:01 ruflin

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 avatar Jan 21 '16 00:01 cameronmurphy

@cameronmurphy Could you provide a PR for this fix?

ruflin avatar Jan 21 '16 08:01 ruflin

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

cameronmurphy avatar May 09 '16 01:05 cameronmurphy

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

Tobion avatar Mar 15 '17 00:03 Tobion

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

ruflin avatar Mar 17 '17 08:03 ruflin

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.

Tobion avatar Mar 17 '17 09:03 Tobion

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

ruflin avatar Mar 17 '17 09:03 ruflin