Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About Error handle #52

Closed
liu1700 opened this issue Mar 16, 2015 · 6 comments
Closed

About Error handle #52

liu1700 opened this issue Mar 16, 2015 · 6 comments

Comments

@liu1700
Copy link

liu1700 commented Mar 16, 2015

Is there any method to access to the Error struct?
im new to this
Thanks!

@olivere
Copy link
Owner

olivere commented Mar 16, 2015

Hi! When an error occurs, we slurp up the error message and return it via an error in the given Do method (see errors.go). Do you need a different way of accessing error information?

@liu1700
Copy link
Author

liu1700 commented Mar 17, 2015

Thanks for answering my question!
Sometimes i just need the Error Status in int or Error Message in string instead of returning a string with error status and messages both

@olivere
Copy link
Owner

olivere commented Mar 17, 2015

Hey, thanks for bringing this up! I was returning a generic error. We can do better... :-)

You are now able to get the error details by "casting" to *elastic.Error which I described here.

Let me know if it doesn't work for you.

@olivere olivere closed this as completed Mar 17, 2015
@liu1700
Copy link
Author

liu1700 commented Mar 17, 2015

Sorry, but it gives me an error

impossible type assertion:
    *elastic.Error does not implement error (wrong type for Error method)
        have Error() error
        want Error() string

am i doing wrong?

@olivere
Copy link
Owner

olivere commented Mar 17, 2015

Seems like you're using the old code. Did you go-get again, like go get -u github.com/olivere/elastic?

@liu1700
Copy link
Author

liu1700 commented Mar 17, 2015

sorry....my fault..forget to update
Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants