void update() { // logic if (!success) { throw ProcessException("explanation"); } } ... void calling_method () { ... try { update(); } catch (const ProcessException e) { // do something } ... //normal flow }