문제

In Delphi, I have a hierarchy of routines. Routine 'A' calls 'B' which calls 'C' which calls 'D'. 'D' does some checking, and it encounters an error of some type, maybe an Exception,maybe just a logical error. Regardless, when 'D' encounters the error, is there anyway for control to pass back to 'A' without having 'D' return a 'failure' code, which 'C' checks for, which returns a failure code, which 'B' checks for, etc...?

Thanks

GS

도움이 되었습니까?

해결책

There are exactly two ways to do what you want:

  1. Return an error/status code and have every function on the call stack check that code.
  2. Raise an exception and handle it at the high level.

You do not wish to use option 1, so that leaves option 2.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top