Hacker News new | past | comments | ask | show | jobs | submit login

by reading this I just learned about the concept of chained exceptions, although I can't see why is so useful, the built-in traceback and sys module has always been good enough:

    import sys,traceback
    try:
        ...
    except Exception as ex:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        logger.error("%s:%s" % (str(ex),  str(traceback.format_exception(exc_type, exc_value, exc_traceback))))
        raise MyException(" :( ")



that's not nearly good enough, it's barely acceptable. i've been programming python for a decade and the fact you have to do this with exceptions was plainly dumb. as a programmer you should never have to worry about preserving tracebacks.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: