Code Monkey home page Code Monkey logo

Comments (5)

pakal avatar pakal commented on September 27, 2024 1

Here is a PR which solves my various needs - resilience regarding callback exceptions, and ordered shutdown: #54

from oscpy.

tshirtman avatar tshirtman commented on September 27, 2024 1

closed in #54

from oscpy.

tshirtman avatar tshirtman commented on September 27, 2024

I'm not a fan of eating errors, but maybe we could give a way for the user to handle exceptions in a way they see fit with such a try/except Exception construct, i think i would raise in the absence of such an error handler value, to avoid this being a surprising property of the system, but still allow users to opt into a more resilient mode.

from oscpy.

pakal avatar pakal commented on September 27, 2024

I think most server frameworks (Django, Flask etc.) handle each request as a separate "task", and have a catch-all which log unhandled exceptions (including traceback), or perform other signalling (eg. sending emails to admins).

I guess a catch-all like that, relying on stdlib logging, would be just fine. It could be switchable by an init argument of the server indeed, even though I wonder: are there cases where having the server stop all operation on error is useful (since it's using UDP and handled by a secondary thread, it makes a quite silent error anyway, doesn't it ?)

(I could work on a PR once we see how it should preferably be done)

from oscpy.

tshirtman avatar tshirtman commented on September 27, 2024

Indeed the fact that it's in a thread makes it less obvious that would be desirable that something went wrong, if you want to work on this, as long as it's possible to register a custom error handler so the calling program can be aware of error and plug whatever report logic it wants, i think that would be fine, and the default behavior could be to log the error, which is indeed better than the current behavior, since it can process further requests. Make sure the error handling interface is described in the server documentation, so it can be easily discovered, and to add tests for the behavior :).

from oscpy.

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.