All pastes #493473 Raw Edit

Unoti

public php v1 · immutable
·published 2007-05-17 20:09 UTC
rendered paste body
result = doFirstThing();if (result==failed){	rollback transaction;	return (failed, "Failed because FirstThing failed because of whatever);}result = doThing2();if (result==failed){	rollback transaction;	return (failed, "failed because thing2 failed");}result = doThing3();if (result==failed){	rollback transaction;	return (failed, "failed because thing3 failed");}//////////////// cleaner way, using exceptionstry{	doFirstThing();	doThing2();	doThing3();}catch (Exception $ex){	rollback transaction;	return('failed', "Failed because ".$ex->getMessage());}