# Learning Zig, can't figure out error handling

**URL:** <https://ziggit.dev/t/learning-zig-cant-figure-out-error-handling/1427>\
**Category:** Help\
**Tags:** language\
**Created:** [August 9, 2023, 8:48pm UTC](https://ziggit.dev/t/learning-zig-cant-figure-out-error-handling/1427 "2023-08-09T20:48:15Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![AndrewCodeDev](https://ziggit.dev/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@AndrewCodeDev](https://ziggit.dev/u/AndrewCodeDev)\
**Post date:** [August 9, 2023, 9:24pm UTC](https://ziggit.dev/t/learning-zig-cant-figure-out-error-handling/1427/6 "2023-08-09T21:24:13Z")

</div>

Yes, this is true but with one caveat - catch unreachable can put you in undefined behavior if you go to ReleaseFast - see: [Why `?` and `orelse unreachable` behave inconsistently under ReleaseFast/ReleaseSmall - #7 by kristoff](https://ziggit.dev/t/why-and-orelse-unreachable-behave-inconsistently-under-releasefast-releasesmall/1373/7)

If you want to discard error conditions if they can occur, you should opt for “catch { }” because it explicitly states “do nothing if we get an error”. That’s different than saying “this block of code should never be reached”.

---

_[View the full topic](https://ziggit.dev/t/learning-zig-cant-figure-out-error-handling/1427)._
