Error handling, part 4, the final part

Error handling, part 4, the final part

Sergey Abbakumov

Facebook

In Facebook you can find another approach. Exceptions are allowed there but in critical code where the performance is very important they use a similar to Expected<T> class from Andrei Alexandrescu: C++ and Beyond 2012: Andrei Alexandrescu - Systematic Error Handling in C++.

Excpected<T> is either the object of class T or std::exception_ptr.

The example of the project is Facebook Folly library: https://github.com/facebook/folly.


Conclusion

Nowadays I work on a Chromium-based browser where exceptions are banned. In general, I can not say that I suffer without them. However, in my opinion, some code can be written more accurately and cleaner with exceptions.

Also I can not say that with exceptions one can't write stable and workable programs. I think that in a small team which is located in one office exceptions will get accustomed. If the team is big and distributed, probably no exceptions policy will be better: the logic of error handling will be clear, there will be less bugs, etc.


The end.


Telegram channel: https://t.me/sea_plus_plus

Report Page