From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=BAYES_20,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:14b1:: with SMTP id x17mr28706604qkj.37.1632209083485; Tue, 21 Sep 2021 00:24:43 -0700 (PDT) X-Received: by 2002:a25:2ccf:: with SMTP id s198mr34413615ybs.452.1632209083239; Tue, 21 Sep 2021 00:24:43 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 21 Sep 2021 00:24:43 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=87.88.29.208; posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH NNTP-Posting-Host: 87.88.29.208 References: <27364e05-ceac-49de-b6b4-954609d00543n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <002f7e98-baca-40a3-85f1-211b77550bc7n@googlegroups.com> Subject: Re: Exception Handling within Gtkada From: Emmanuel Briot Injection-Date: Tue, 21 Sep 2021 07:24:43 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:62805 List-Id: > > Generally, Ada exceptions must not left scope of callback function. Thu= s, such code should be added to each callback/event handler/etc. subprogram= of your application. > Right. Each handler should end like this:=20 We were talking the other day of the high-level Connect subprograms generat= ed by GtkAda (`Gtk.Button.On_Clicked` and so on). Those will always catch e= xceptions and avoid propagating them to the C layer in gtk+ (which as Dmitr= y mentions is dangerous). They will in effect call `GtkAda.Bindings.Process= _Exception`, which in turns calls a user-defined subprogram, see GtkAda.Bin= dings.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.