comp.lang.ada
 help / color / mirror / Atom feed
From: Emmanuel Briot <briot.emmanuel@gmail.com>
Subject: Re: Exception Handling within Gtkada
Date: Tue, 21 Sep 2021 00:24:43 -0700 (PDT)	[thread overview]
Message-ID: <002f7e98-baca-40a3-85f1-211b77550bc7n@googlegroups.com> (raw)
In-Reply-To: <sic00e$1q61$1@gioia.aioe.org>

> > Generally, Ada exceptions must not left scope of callback function. Thus, such code should be added to each callback/event handler/etc. subprogram of your application.
> Right. Each handler should end like this: 

We were talking the other day of the high-level Connect subprograms generated by GtkAda (`Gtk.Button.On_Clicked` and so on). Those will always catch exceptions and avoid propagating them to the C layer in gtk+ (which as Dmitry mentions is dangerous). They will in effect call `GtkAda.Bindings.Process_Exception`, which in turns calls a user-defined subprogram, see GtkAda.Bindings.Set_On_Exceptions

I think this should be the recommended approach for general exceptions. Of course, your callbacks should directly handle exceptions that they know how to recover from, and deal with that locally.

  reply	other threads:[~2021-09-21  7:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <nnd$672ea4c3$361caa01@549d065034cf3e10>
2021-09-21  6:49 ` Exception Handling within Gtkada Vadim Godunko
2021-09-21  7:01   ` Dmitry A. Kazakov
2021-09-21  7:24     ` Emmanuel Briot [this message]
2021-09-21  7:40       ` Dmitry A. Kazakov
2021-09-22  8:42     ` ldries46
2021-09-22 10:22       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox