Re: [Firebird-devel] Handling exception from external plugins

2022-04-12 Thread Alex Peshkoff via Firebird-devel

On 4/12/22 11:53, Roman Simakov wrote:

Alex,

Is it documented somewhere?


Exactly in this form - not. I.e. a fact that exceptions are caught when 
throwing from OO API functions is documented (in Using_OO_API) and 
special position of FbException is documented too, but need of first 
Status parameter to make all that work is not emphasized. To be precise 
- _any_ exception in _any_ OO API function will be caught, but it will 
not be delivered in original way to caller. The humor is that 
FB_PLUGIN_ENTRY_POINT (except missing Status parameter) is not OO API 
call - it's just plain C function which is needed to 'boot' OO API in 
plugin, and certainly it should not throw over module boundaries.



пн, 11 апр. 2022 г. в 18:45, Alex Peshkoff via Firebird-devel
:

On 4/11/22 17:56, Dimitry Sibiryakov wrote:

Vasiliy Yashkov wrote 11.04.2022 16:52:

What is the right way to throw an exception?

   Plugins (as any other DLL) is not supposed to throw exceptions ever.


Yes, throwing directly (like in your code) is impossible. But there is a
way to return an exception information from plugin using Status
interface, which is passed as first parameter in that case.
Pay attention - FB_PLUGIN_ENTRY_POINT has no such parameter and
therefore is not expected to return exception information. (there are
more reasons why exceptions not to be used in that call but let me not
dive too deep here)

But if some plugin entry has first Status parameter you can throw
FbException in it, it will be caught by thin API layer which actually
invoked your plugin entry and delivered to the code which called plugin.




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel







Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Handling exception from external plugins

2022-04-12 Thread Roman Simakov
Alex,

Is it documented somewhere?

пн, 11 апр. 2022 г. в 18:45, Alex Peshkoff via Firebird-devel
:
>
> On 4/11/22 17:56, Dimitry Sibiryakov wrote:
> > Vasiliy Yashkov wrote 11.04.2022 16:52:
> >> What is the right way to throw an exception?
> >
> >   Plugins (as any other DLL) is not supposed to throw exceptions ever.
> >
>
> Yes, throwing directly (like in your code) is impossible. But there is a
> way to return an exception information from plugin using Status
> interface, which is passed as first parameter in that case.
> Pay attention - FB_PLUGIN_ENTRY_POINT has no such parameter and
> therefore is not expected to return exception information. (there are
> more reasons why exceptions not to be used in that call but let me not
> dive too deep here)
>
> But if some plugin entry has first Status parameter you can throw
> FbException in it, it will be caught by thin API layer which actually
> invoked your plugin entry and delivered to the code which called plugin.
>
>
>
>
> Firebird-Devel mailing list, web interface at 
> https://lists.sourceforge.net/lists/listinfo/firebird-devel



-- 
Роман Симаков


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel