DEV Community


Discussion on: Elegant Error Handling with C++

dataphil_lib profile image
Philip H.

That's a good option for functions that would not return anything real, except a success indication. For other functions I really like to use std::optional to handle possible failures. This does not offer a way to tell the caller what went wrong, but there a lots of situations where that is not necessary.