mirror of https://github.com/sunface/rust-course
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
733 B
13 lines
733 B
3 years ago
|
# 错误处理
|
||
|
大多数的错误并没有严重到需要让程序完全停止运行的程度。
|
||
|
有时一个函数执行失败时,你可以很容易地对造成失败的原因进行解释并采取对应措施的。
|
||
|
例如,你正试图打开一个文件,但由于该文件不存在导致了操作失败,这时你可能想创建
|
||
|
该文件而不是直接终止程序。
|
||
3 years ago
|
|
||
3 years ago
|
## 更多信息
|
||
3 years ago
|
|
||
|
- [Error Handling](https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html)
|
||
|
- [Generics](https://doc.rust-lang.org/book/ch10-01-syntax.html)
|
||
|
- [Result](https://doc.rust-lang.org/rust-by-example/error/result.html)
|
||
|
- [Boxing errors](https://doc.rust-lang.org/rust-by-example/error/multiple_error_types/boxing_errors.html)
|