The Rust Programming Language
- Recoverable and Unrecoverable errors
- recoverable error
- ex) file not found error
- type Result<T, E>
- unrecoverable error
- ex) index out of range, ...
- symptoms of bugs
- immediately stop the program
- Rust doesn't have exceptions
- panic! macro that stops execution when the program encounters an unrecoverable error
- Unrecoverable Errors with panic!
- Using a panic! Backtrace
- Backtrace is a list of all the functions that have been called to get to this point
- Recoverable Errors with Result
- Matching on Different Errors
- Shortcuts for Panic on Error: unwrap and expect
- Propagating Errors
- A Shortcut for Propagating Errors: the ? Operator
- Where The ? Operator Can Be Used
- To panic! or Not to panic!
- Examples, Prototype Code, and Tests
- Cases in Which You Have More Information Than the Compiler
- Guidelines for Error Handling
- Creating Custom Types for Validation
- Summary
'Personal-Study > Rust' 카테고리의 다른 글
[Rust 문서 읽기] 8. Common Collections (일반적인 컬렉션) (0) | 2023.02.11 |
---|---|
[Rust 문서 읽기] 7. Managing Growing Projects with Packages, Crates, and Modules (모듈) (0) | 2023.02.11 |
[Rust 문서 읽기] 6. Enums and Pattern Matching (열거형과 패턴 매칭) (0) | 2023.02.05 |
[Rust 문서 읽기] 5. Using Structs to Structure Related Data (연관된 데이터들을 구조체로 다루기) (0) | 2023.02.05 |
[Rust 문서 읽기] 4. Understanding Ownership (소유권 이해하기) (0) | 2023.01.29 |
댓글