seanmonstar / errors Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
An Error
likely has a message, it might have a cause, and someday, it may have a trace/frame. How should they be formatted? What is a good default, and how should a user configure to their needs?
Top message only
ship exploded
Top message + message of source chain
ship exploded: cat hair in generator
Top message + message of source chain + trace/frame
ship exploded
at main.rs:55
at ship.rs:89
Caused by: cat hair in generator
at ship::parts::generator.rs:33
at ship::parts::engine.rs:789
at ship.rs:89
at main.rs:55
The user can specify some flags when trying to format a value:
{}
{:#}
{:+}
Error
s could interpret this differently.{:.3}
Error
s to mean "maximum iterators down source chain"{}
): Print only the top-level message. This is inline with the recommendation for Error
println!("top only = {}", err)
outputs top only = ship exploded
.println!("top only: {:.0}", err)
.{:+}
): Prints the message, and the message of each source, joined by ": "
.
println!("chain = {:+}", err)
outputs chain = ship exploded: cat hair in generator
.{:#}
): Prints the message and stack trace/frame
println!("top trace = {:#}", err)
outputs top trace = ship exploded\n at ship.rs:89
.{:+#}
): Prints the message and stack trace/frame, and message and trace for each source, joined by \nCaused by:
.{:+.2}
): Sets the maximum messages that should be printed down the source chain.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.