Chapter 7. 오류처리

This chapter covers the two different kinds of error handling in Rust: panic and Results.

Rust에서의 두 가지 에러 처리 방법인 패닉(panic)결과(Result)를 다룬다.

Ordinary errors are handled using the Result type. Results typically represent problems caused by things outside the program, like erroneous input, a network outage, or a permissions problem. That such situations occur is not up to us; even a bug-free program will encounter them from time to tim

일반적인 에러는 Result 타입을 사용하여 처리한다. Result는 보통 프로그램 외부의 요인, 예를 들어 잘못된 입력, 네트워크 장애, 또는 권한 문제로 인해 발생하는 문제를 나타낸다. 이러한 상황은 우리가 통제할 수 없으며, 버그가 없는 프로그램이라도 가끔은 이런 문제를 마주하게 된다.

Panic is for the other kind of error, the kind that should never happen.

패닉은 다른 종류의 오류, 즉 절대 발생해서는 안 되는 에러입니다.

01. Panic(패닉)

A program panics when it encounters something so messed up that there must be a bug in the program itself.

프로그램 자체에 있는 버그로 인해 문제가 생기면 프로그램은 패닉에 빠진다.