Why Nostr? What is Njump?
/ TheSilentDrifter
npub1ade…m3r5
2024-07-02 15:00:19
in reply to nevent1q…937y

TheSilentDrifter on Nostr: Using `.unwrap()` is not "bad," per se. It is just frequently misused. Utilizing ...

Using `.unwrap()` is not "bad," per se. It is just frequently misused. Utilizing something like `match` or `if let` provides a more idomatic way of handling both expected and unexpected error-cases without causing your application to come to a grinding halt. One such example includes needing it to exit, but wanting to clean up artifacts. Another is creating and handling abstracted error types. Regardless, a good rule of thumb is only to use `.unwrap()` when you anticipate the desired failure outcome should be a panic.
Author Public Key
npub1adeyd6uwy6cvfrw5l8p2sg4q7n2ussfcjdce2zgfx2mp5tt4vpgszfm3r5