The aim of this patch is to refactor how we handle and report error.
I suggest to use the same approach we use in LLD: delayed error reporting.
For that I introduced 'HasError' flag which triggers when we report an error.
Now we do not exit instantly on any error. The benefits are:
- There are no more 'exit(1)' calls in the library code.
- Code was simplified significantly in a few places.
- It is now possible to print multiple errors instead of only one.
Also, I changed the messages to be lower case and removed a full stop.