Comments (1)
I have created an example: https://github.com/salvo-rs/salvo/blob/master/examples/handle_error.rs
Current implementation for anyhow is too simple, just return 500 error, we may let it more flexible in future.
If you want handle your custom error, just implement Writer trait for your custom error.
In writer function, you can access request, deport and response, so you can do something like: just show error details to internal users or in debug mode.
run command to view this example:
cargo run --example handle_error
and then view this two page in your browser:
http://localhost:7878/custom
http://localhost:7878/anyhow
from salvo.
Related Issues (20)
- Generic response (openapi) HOT 2
- how to do so_reuseport implementation? HOT 1
- Add reqwest client to proxy middleware HOT 1
- Auto add ToSchema bound to generic type
- 如何集成casbin访问控制到中间件里去啊? HOT 1
- UNSPECIFIED Ipv4 and Ipv6 use same port crash in centos HOT 2
- #[handler] and #[endpoint] supports generic function
- Update quinn to 0.11 and remove old rustls
- 1.0 release planning
- Improve documentation and official website HOT 1
- use of undeclared crate or module `serde_json` HOT 4
- cors not working
- Salvo does not take into account the schema name for generics HOT 11
- JWT模块中对数据结构有必须定义`expr`字段要,文档没有说明且易引起用户误用 HOT 1
- example-otlp don't work normally
- Why write status code twice? HOT 7
- There is a probabilistic hang bug in the "graceful shutdown" phase HOT 2
- opanapi 接口组和接口的排序问题 HOT 1
- stack overflow when using recursive struct with openapi HOT 2
- features添加quinn后,无法在windows上交叉编译为linux二进制 HOT 4
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 salvo.