jrudolph / better-future-exceptions Goto Github PK
View Code? Open in Web Editor NEWA POC for better exception reporting for futures
A POC for better exception reporting for futures
After a glance through what I tried to achieve I think this needs much more work to be useful and elegant. The repo contains not more than a demo of one aspect of how error reporting could look like.
Thinking about it, the meaning of a "stacktrace" or a "callstack" is not so obvious with Futures. You can build arbitrarily complex data flow graphs using the Future
combinators that will be executed in an asynchronous fashion. This means that you don't have the one callstack but in fact you usually have at least two entwined stages that may produce several callstacks due to asynchronicity and runtime creation of the data flow structure:
Future.apply
and all the other combinators, where each combinator call is called from a different callstackflatMap
may actually do both stages in one execution thread complicating things further.
Even under the assumption that one could capture all those stacktraces at the various Future
methods, you still need to think about how to present this huge amount of data (huge in relation to a simple stacktrace) to the user in a meaningful way.
On the more technical side, my suspicion is that the full-blown solution would slow Future creation/execution down significantly, so you usually wouldn't want to have the full dynamic error-reporting/stacktrace collection switched on all the time. One solution could be to write an aspect-based library that would add tracing / better error reporting facilities just for debugging purposes, so that you would just have to change configuration, instead, of having to change actual code. The obvious downside would be that you wouldn't run this in production.
For production code a more static approach like the one demoed in the current version could work where only the static user entry-points into the Future DSL are captured (instead of actual dynamic stacktraces of the calls). You would then still be able to retain the dynamic structure of the data flow itself which led to an error.
Every solution found here would also have a possible application for (reactive) streams as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.