Exceptions: Difference between revisions

m
(note about 'return rv' pattern)
Line 68: Line 68:


   nsresult rv = callSomeMethod();
   nsresult rv = callSomeMethod();
   // note: no code between call & rv test
   // note1: no code between call & rv test -- such code can of course be
   // note: also accept NS_SUCCEEDED(rv) with code in opposite then/else branches
  //        accommodated with exceptions but requires more design
   // note2: also accept NS_SUCCEEDED(rv) with code in opposite then/else branches
   if (NS_FAILED(rv)) {
   if (NS_FAILED(rv)) {
     maybe fixup();
     maybe fixup();
313

edits