Odak modu

Rust Fundamentals

Error Handling

Rust does not allow you to ignore errors that may cause problems in the future with its error mechanism. This is an important element of reliability.

In Rust, there are two kinds of errors, while most language does not distinguish between two errors:

  • Recoverable errors

These are errors like "file not found" that don't need the program to abruptly terminate. By notifying the user of the situation, we generally aim to re-run it after fixing the problem. Rust uses a data type Result <R,T> to handle recoverable errors.

  • Unrecoverable errors (cause a program to fail abruptly)

Unrecoverable errors are ones that can't be resolved by a programmer. Rust has Panic! macro that make the program stop abruptly when such an error occurs. These panics will, by default, display a failure message, unwind, clean up the stack, and exit.

To understand Rust’s error handling in more detail, you can watch this video that explain the subject in detail here:

https://www.youtube.com/watch?v=s7z_sdPBwFg 

You can find detailed further information from Rust Official documentation:

https://doc.rust-lang.org/book/ch09-00-error-handling.html 

Resources:

https://kerkour.com/rust-error-handling

https://www.geeksforgeeks.org/rust-recoverable-errors/ 

https://www.geeksforgeeks.org/rust-unrecoverable-errors/

https://fettblog.eu/rust-error-handling/

Background Pattern
Birlikte öğrenelim

Sektörde en çok aranan yazılım becerilerini kazan

Yapay zeka desteği, birebir mentörlük saatleri, canlı dersler ve senin için özel hazırlanmış içeriklerle eksiklerini tamamla, düzenli geri bildirimler al ve öğrenme sürecini en verimli hale getir.

Yunus Emre Kabakcı

Patika+ mezunu

Patika+ Fullstack Web Development Bootcamp mezunumuz Yunus Emre,

3 ay içinde Katar’dan aldığı teklif ile, global bir şirket olan Pavo Group’da işe başladı!


“İçerik zenginliği, mentor desteği, ileriye dönük bir network sağlaması ve dünyada en çok tercih edilen frameworkler üzerinden bir eğitim veriyor olması Patika+’ı tercih etmemin temel sebepleri oldu!“

Test

Yorumlar

Yorum yapabilmek için derse kayıt olmalısın!