Comments (1)
Based on https://stackoverflow.com/questions/66122388/is-it-possible-to-walk-stack-frames-from-an-exception and looking through the StackWalker
docs, I'm not sure the complete issue would be feasible. (We can do some parts of it but not all of it)
- Most of our usages of
getStackTrace()
are from reporting the stack trace of an already thrown exception. However, the StackOverflow post linked above indicates thatStackWalker
can't be used to process the stack trace of an already thrown exception, soDriverStation.reportError()
andMathSharedStore.reportError()
have to keep theStackTraceElement[]
parameter for that use case. We could makeDriverStation.reportError(String error, boolean printTrace)
overload useStackWalker
, but that would lead to code duplication since we still need the logic for theStackTraceElement[]
case. - This isn't the main point of this issue, but the efficiency seems to be from not having to create all of the stack trace elements, but because our usages of the stack traces are reporting errors, we have to process all of the stack trace elements anyways. (The only elements we skip are from the top of the stack, which means that the walker still has to create all of the elements for us to either determine we should skip or to report in the (processed) stack trace)
Summary: We could use StackWalker
for DriverStation.reportError(String error, boolean printTrace)
, but that would lead to code duplication. If we want to use the stream API for more ergonomic processing, we could stream the array of stack trace elements (though that would add the stream API's overhead).
from allwpilib.
Related Issues (20)
- Deprecate robotInit() HOT 2
- CommandRobot discussion HOT 1
- DifferentialDrivetrainSimTest doesn't converge (sometimes) because of LTVUnicycleController HOT 1
- Add `Twist2d ChassisSpeeds::ToTwist2d(units::second_t dt) const`
- Refactor default commands to be held by the subsystem (resource) not the scheduler. HOT 1
- `SimHooks.stepTiming()` hangs when called from a callback registered with `SimDeviceSim.registerValueChangedCallback()` if another `SimDeviceSim` has been created HOT 2
- Make usage of `Set` and `...` syntax more consistent HOT 3
- [cmd] Use command factories and decorators in command tests
- Use codegen for Datalog entry types
- Add array and/or string support to `SimDevice`/`SimDeviceSim`. HOT 2
- Mode-exit functions are missing from Robot.java in several templates HOT 1
- Make DriverStation error and warning reporting easier in C++ HOT 3
- Improve the Java Units Library with additional methods and unit types HOT 4
- Sim GUI does not disable joystick data in auto mode
- [wpimath] Remove or deprecate unused WheelPositions interface/concept HOT 4
- Provide a way to flush NetworkTables to the wire immediately HOT 8
- Question about New Radio from Vivid Hosting wireless connection HOT 4
- NetworkTables server crashes when publishers are rapidly created and closed HOT 6
- Closing NetworkTables publisher doesn't flush queued data HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from allwpilib.