Make errors easier to handle in C++