Coder Social home page Coder Social logo

Comments (3)

jmchilton avatar jmchilton commented on July 20, 2024

So ideally all API exceptions would get handled through this method - they don't and that is a problem (https://github.com/galaxyproject/galaxy/blob/dev/lib/galaxy/web/framework/decorators.py#L280). That said - we could build better exceptions on this side of things I think to handle the good and bad Galaxy exceptions:

GalaxyExceptionGeneric(Exception):
    """Generic non-2XX response exception with r.text and status_code available"""
    ...

GalaxyException(GalaxyExceptionGeneric):
    """properly formatted exception with extra fields for err_code, err_msg, extra_error_info, traceback (for admins)"""
    ...

from bioblend.

nsoranzo avatar nsoranzo commented on July 20, 2024

I'm not comfortable with just raising r.text, but the GalaxyException approach would be nice!

from bioblend.

hexylena avatar hexylena commented on July 20, 2024

@jmchilton the error message IS coming from the correct API decorator on the galaxy side. On the BioBlend side, it's being handled differently in some weird cases:

After more digging, this appears to be the norm, with

bioblend.galaxy.client.ConnectionError: Unexpected response from galaxy: 400: {"traceback": "Traceback (most recent call last):\n  File \"/home/users/cpt/cpt/esr/Projects/galaxy/galaxy/lib/galaxy/web/framework/decorators.py\", line 251, in decorator\n    rval = func( self, trans, *args, **kwargs)\n  File \"/home/users/cpt/cpt/esr/Projects/galaxy/galaxy/lib/galaxy/webapps/tool_shed/api/repositories.py\", line 628, in create\n    raise exceptions.RequestParameterInvalidException( invalid_message )\nRequestParameterInvalidException: You already own a repository named <b>test<\/b>, please choose a different name.\n", "err_msg": "You already own a repository named <b>test<\/b>, please choose a different name.", "err_code": 400008}

Looking further, I'm getting bioblend.galaxy.client.ConnectionErrors for just about all of my exceptions. That said, I used this sort of parsing in planemo and that behaves nicely and prints err_msg rather than the JSON string.

I think I'm starting to see it...make_post_request is the ONLY method to use a ConnectionError? The rest of the methods don't catch the exceptions at all, and toss the upwards as-is.

from bioblend.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.