Rust: Smart Exception Handling with Result

Exception Handling: When I started working on computer systems or especially programming, one thing I used to hear from colleague or friends "My code is broken" or In Hindi "Code fat Gaya". I have worked in such scenarios where the code is not working on production system and had to look into the logs for any Exception stacktrace or Errors statements that I can check. You must agree with me that intelligently reading and analyzing the logs is an art . When working with Rust there are two types of Errors panic! (Unrecoverable errors) Result<T,E> (recoverable errors) panic!: Unrecoverable errors can occur anywhere. It may be because of bug in your code or in the library you are using. When such a situation occurs Rust calls Panic macro (! symbol is for macro). After calling panic, it tries to undo the changes that the program did (called as Unwinding) and then exit. But if its large program the Unwinding may take