質問

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