jszwedko/circleci-cli

cannot get projects

Closed this issue · 9 comments

eyal@eyal-Lenovo-Y50-70:~/develop/git/booyah-android$ circleci-cli projects
json: cannot unmarshal string into Go value of type bool

This is AFTER i've set export CIRCLE_TOKEN=my_token (before that i got 401 u need to loging first which is also bad error message since your cli does not have 'login' command, should be 'please supply API TOKEN either using -t or using CIRCLE_TOKEN environment variable.'

Unfortunately circleci-cli projects returns a user specific list of projects and Go's encoding/json doesn't give very helpful error messages when deserializing (yet). I see you also opened #5 which would empower you to help, but in lieu of that, do you mind gist'ing the JSON returned from https://circleci.com/api/v1/projects?circle-token=XXXXX? If you feel more comfortable sharing directly with me rather than posting here, you can also send it via e-mail to me at jesse.szwedko@gmail.com.

And agreed, the current error behavior is basically to pass the exact error back from CircleCI, but we should handle at least 401s more gracefully -- I'll spin off a separate issue for that.

10x! :-)
i'll check the debug thingy u posted and see the json that gets back to me,
naturally i didn't expect u to go on nothing i want to understand what's
the problem, could very well be that u get htp 2xx response with error json
from circle API. and then your json parser fails. but i need to see it, i'm
not that experienced in GO (python\java\c) so i have a bit hard time
reading the code :-)

On Fri, Sep 9, 2016 at 8:02 AM, Jesse Szwedko notifications@github.com
wrote:

Unfortunately circleci-projects returns a user specific list of projects
and Go's encoding/json doesn't give very helpful error messages when
deserializing (yet https://go-review.googlesource.com/#/c/18692/. I see
you also opened #5 #5
which empower you to help, but in lieu of that, do you mind gist'ing the
JSON returned from https://circleci.com/api/v1/projects?circle-token=XXXXX?
If you feel more comfortable sharing directly with me rather than posting
here, you can also send it via e-mail to me at jesse.szwedko@gmail.com.

And agreed, the current error behavior is basically to pass the exact
error back from CircleCI, but we should handle at least 401s more
gracefully -- I'll spin off a separate issue for that.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#4 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMNU_JJar-hV14u-sXXXVJxB2REgzgyjks5qoOhfgaJpZM4J3q1I
.

Hi @eyal-rounds,

Do you mind trying out the prerelease I created (https://github.com/jszwedko/circleci-cli/releases/tag/0.2.0-pre) and let me know what error message it gives you? I was able to vendor and make some adjustments to the JSON deserializing library to give more informative error messages. There is also a -d flag you can now use to enable debugging of the HTTP request and responses.

Thank you!

ok. 10x, will test and get back to u!

On Mon, Sep 12, 2016 at 3:11 AM, Jesse Szwedko notifications@github.com
wrote:

Hi @eyal-rounds https://github.com/eyal-rounds,

Do you mind trying out the prerelease I created (
https://github.com/jszwedko/circleci-cli/releases/tag/0.2.0-pre) and let
me know what error message it gives you? I was able to vendor and make some
adjustments to the JSON deserializing library to give more informative
error messages. There is also a -d flag you can now use to enable
debugging of the HTTP request and responses.

Thank you!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#4 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMNU_GLVlExeMXwy5wY1fbEsksPq_j0Cks5qpJjJgaJpZM4J3q1I
.

ok, tried it, the -d works great! i followed the Project ype and tried to figure out which boolean he can't parse, so one of two, either getting null for boolean is not acceptable by the json module OR one of the inner Project maps is having this issue, the only thing i can ask is if u have a code that unmarshals only the top level componenets so i can test it on my own on ALL my objects.
i can write one myself but since i'm not a go developer it will probably take long time
(go program that takes as param a file name that contains a json string, reads it into a string and tries to parse it as a Project object)
i can then split the text i get from circle and run it one by one on ALL my "Project" objects and see if all are problematic or only one and if one of them then i can play with the fields to find out which is causing the issue.

@eyal-rounds awesome, I'm glad that worked for you. Can you post the exact error message that it is giving you? Just knowing the field name might be enough to help me investigate and address.

yes i can, once i'm next t o my work pc tomorrow :-)
it basically says it can't unmarshal string value to Boolean from json object.

Closing this out, but please feel free to reopen if you are able to try out the latest release (which has the additional debug/error handling).

10x. will do.

On Sat, Nov 19, 2016 at 7:45 PM, Jesse Szwedko notifications@github.com
wrote:

Closed #4 #4.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#4 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AMNU_P4tZzhxqgPzzofFCfFtsbIJ2Zraks5q_zWegaJpZM4J3q1I
.