Search code examples
delphichecked-exceptions

How to specify the exceptions raised by a Delphi method?


Again a Delphi newbie question. Is there a standard way of specifying the exceptions raised by a method (I have googled this but can't seem to find anything on the topic beyond the basics of handling exceptions).

In other words is there a standard way of saying "my function/procedure can throw this specific exception" in the function/procedure signature (I assume no). What is then the best practice to let the client of your API know which kind of exceptions will be raised by a given procedure/method


Solution

  • There is no syntax in the Delphi pascal language to do what you are asking for. All you can do is list the possible exceptions in the function/procedure/method's documentation.