Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

บทที่ 9: Error Handling - การจัดการ Error

Rust มีระบบจัดการ error ที่แข็งแกร่ง แบ่งเป็น 2 ประเภท:

ประเภทใช้เมื่อ
panic!Error ร้ายแรง, ไม่สามารถ recover ได้
Result<T, E>Error ที่สามารถจัดการได้

สิ่งที่จะได้เรียนรู้

หัวข้อคำอธิบาย
panic!เมื่อไหร่ควรใช้
Resultวิธีจัดการ recoverable errors
? operatorการส่งต่อ error แบบกระชับ
Custom Errorsสร้าง error type เอง

เริ่มกันเลย!

👉 panic!