`fatalError` without a way to intercept it is harmful on the server

Not so long ago I played with the idea of dynamic throw/catch – a concept similar to unchecked exceptions in other languages.

dl;dr version: compared to normal throwing functions the functions are not "coloured" by being throwing v non-throwing and there is no viral effect on the callers (that with normal swift throwing functions must "try" and potentially be marked throwing themselves infecting their callers in turn. Unchecked exceptions are adoptable on an opt-in basis: if you don't catch them they behaves as they are today (terminating the process) and if you opt-in to catch those you could catch them and proceed accordingly, be it a fatalError† or a precondition† failure or an index out of bounds on array subscripts†, or etc†.


† - the dynamic throwing equivalents of those.

1 Like