For aircraft software neither approach is acceptable. You can't have crashes, you can't have exceptions, you can't have error codes, you can't have any other way to signal that something went wrong. Instead, the thing has to not go wrong.
You can't have error codes? I have never seen anything saying that you can't. (If there is something I have missed, feel free to cite it.)
Of course you can have things go wrong. Things actually do. But when they do, it has to not crash - neither the software nor the plane.
You got a malformed packet from some other system? You'd better not use it like it's valid, and you'd better not crash. Returning an error code to say "that packet wasn't valid" is a perfectly valid way to deal with it.
The engine fell off the plane? You'd better not be trying to respond to the sensor readings from that engine any more, because they are by definition garbage.
Sure, for each individual thing, try as hard as possible to make it so that it cannot go wrong. But that won't be possible for everything. For the rest, make it so that it can go wrong and you still have a flyable plane and running software.
You can't have error codes? I have never seen anything saying that you can't. (If there is something I have missed, feel free to cite it.)
Of course you can have things go wrong. Things actually do. But when they do, it has to not crash - neither the software nor the plane.
You got a malformed packet from some other system? You'd better not use it like it's valid, and you'd better not crash. Returning an error code to say "that packet wasn't valid" is a perfectly valid way to deal with it.
The engine fell off the plane? You'd better not be trying to respond to the sensor readings from that engine any more, because they are by definition garbage.
Sure, for each individual thing, try as hard as possible to make it so that it cannot go wrong. But that won't be possible for everything. For the rest, make it so that it can go wrong and you still have a flyable plane and running software.