Code Monkey home page Code Monkey logo

Comments (4)

adamchainz avatar adamchainz commented on July 18, 2024

I've realized I can update my custom exception to inherit from BaseException to get it to raise through this statement, but there are probably other use cases still blocked by excessive try/except through the library.

from aws-xray-sdk-python.

haotianw465 avatar haotianw465 commented on July 18, 2024

Hi, the idea of those try/except blocks is that X-Ray tracing is not mission critical from an customer application's standpoint. It should not break the application because of any library internal issue or sometimes even instrumentation bug.

But I do agree there is a valid use case. There is a bad design where anything happens inside serialization is swallowed in the data model level, which doesn't give the caller much control of exception handling. The right fix IMO is to have the emitter module to handle this exception since emitter is the one responsible for serialization and UDP transmission. That way you can override the emitter module and handle your custom exception the way you need.

The excessive try/except act as a firewall between the library and your application code. We can improve those places case by case like this time but I would argue the current approach is better to begin with. Please let me know if you have any additional thoughts.

from aws-xray-sdk-python.

adamchainz avatar adamchainz commented on July 18, 2024

You're right, I think my use case is a bit niche and I've worked around it by making it inherit from BaseException, which makes it a lot more like KeyboardInterrupt / SystemExit which are also whole-program control-flow exceptions. At least nothing in xray is doing unspecified try/except which is the evilest 😈 (actually one test does! test_async_local_storage.py )

Having some way to customize which exceptions are ignored would probably be useful for someone but not for my application so I don't mind this issue being closed now.

from aws-xray-sdk-python.

haotianw465 avatar haotianw465 commented on July 18, 2024

Thank you for explaining your use case and we appreciate your feedback. I'm closing this now and track this as a refactor item internally.

from aws-xray-sdk-python.

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.