Skip to content
This repository was archived by the owner on Nov 4, 2020. It is now read-only.
This repository was archived by the owner on Nov 4, 2020. It is now read-only.

function return result #193

Open
Open

Description

@leslie89xlxiao

Methods in gitlab client return barely False without any err_msg info. I think the error message is very useful in many cases, hoping error message would be supported soon.

thx

Activity

  1. Sudo-Kid commented on May 16, 2017

    @Sudo-Kid
    Contributor

    They are being worked on at the moment.

  2. Sudo-Kid commented on May 17, 2017

    @Sudo-Kid
    Contributor

    Another issue for a switch away from True/False to add error messages. #224

  3. Sudo-Kid commented on May 17, 2017

    @Sudo-Kid
    Contributor

    I'm still working on getting all the old methods switched over to the new pattern witch will fix this issue. Though to keep backwards compatibility I'm adding new methods and calling them from the old ones. This will allow users to keep there old code and replace it with new code when/where they want to.

  4. e4r7hbug commented on Jul 6, 2017

    @e4r7hbug
    Contributor

    Instead of keeping a list of good status codes for each call, have you considered using the raise_for_status() method?

    >>> import requests
    >>> response = requests.get('https://httpbin.org/status/418')
    >>> try:
    ...     response.raise_for_status()
    ... except requests.exceptions.HTTPError as error:
    ...     request_error = error
    ...
    >>> print(request_error.response.text)
    
        -=[ teapot ]=-
    
           _...._
         .'  _ _ `.
        | ."` ^ `". _,
        \_;`"---"`|//
          |       ;/
          \_     _/
            `"""`
    

    The HTTPError exception that raises gives us access to the original response that we can use.

  5. Sudo-Kid commented on Jul 6, 2017

    @Sudo-Kid
    Contributor

    I wasn't aware of that method. It looks like it should work better then the pattern that I currently have implemented. If you want to submit a PR I would be happy to test and commit it right away.

  6. e4r7hbug commented on Jul 6, 2017

    @e4r7hbug
    Contributor

    Cool. I'll see if I can get something for you going then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions