public inbox for cygwin-apps-cvs@sourceware.org help / color / mirror / Atom feed
From: kbrown@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [setup - the official Cygwin setup program] branch master, updated. release_2.883-4-g2782008 Date: Mon, 08 Jan 2018 14:47:00 -0000 [thread overview] Message-ID: <20180108144740.91841.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=27820085c4a706d9c59a7faae1ac9efa1c0b3cba commit 27820085c4a706d9c59a7faae1ac9efa1c0b3cba Author: Ken Brown <kbrown@cornell.edu> Date: Tue Dec 19 11:10:22 2017 -0500 Throw exceptions instead of exiting with error codes There were two places in PickView.cc and one in choose.cc where setup would silently die with an error code. Change this so that setup now throws exceptions. The exceptions are caught by TOPLEVEL_CATCH("DialogProc") in PropertyPage::DialogProc(). Diff: --- Exception.h | 1 + PickView.cc | 11 +++++++---- choose.cc | 7 +++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Exception.h b/Exception.h index 4aeb49e..e4abd18 100644 --- a/Exception.h +++ b/Exception.h @@ -36,6 +36,7 @@ private: #define APPERR_CORRUPT_PACKAGE 1 #define APPERR_IO_ERROR 2 #define APPERR_LOGIC_ERROR 3 +#define APPERR_WINDOW_ERROR 4 #define TOPLEVEL_CATCH(owner, threadname) \ catch (Exception *e) \ diff --git a/PickView.cc b/PickView.cc index d24866c..2e1beda 100644 --- a/PickView.cc +++ b/PickView.cc @@ -27,6 +27,7 @@ /* For 'source' */ #include "state.h" #include "LogSingleton.h" +#include "Exception.h" using namespace std; @@ -539,8 +540,9 @@ PickView::init(views _mode) HDS_HORZ, 0, 0, 0, 0, GetHWND(), (HMENU) IDC_CHOOSE_LISTHEADER, hinstance, (LPVOID) NULL)) == NULL) - // FIXME: throw an exception - exit (10); + throw new Exception (TOSTRING(__LINE__) " " __FILE__, + "Unable to create list header window", + APPERR_WINDOW_ERROR); // Retrieve the bounding rectangle of the parent window's // client area, and then request size and position values @@ -550,8 +552,9 @@ PickView::init(views _mode) hdl.prc = &rcParent; hdl.pwpos = ℘ if (!SendMessage (listheader, HDM_LAYOUT, 0, (LPARAM) & hdl)) - // FIXME: throw an exception - exit (11); + throw new Exception (TOSTRING(__LINE__) " " __FILE__, + "Unable to get size and position of rectangle", + APPERR_WINDOW_ERROR); // Set the font of the listheader, but don't redraw, because its not shown // yet.This message does not return a value, so we are not checking it as we diff --git a/choose.cc b/choose.cc index c78f55d..32600c8 100644 --- a/choose.cc +++ b/choose.cc @@ -57,6 +57,8 @@ #include "UserSettings.h" +#include "Exception.h" + #include "getopt++/BoolOption.h" static BoolOption UpgradeAlsoOption (false, 'g', "upgrade-also", "also upgrade installed packages"); static BoolOption CleanOrphansOption (false, 'o', "delete-orphans", "remove orphaned packages"); @@ -143,8 +145,9 @@ ChooserPage::createListview () chooser = new PickView (cat); RECT r = getDefaultListViewSize(); if (!chooser->Create(this, WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,&r)) - // TODO throw exception - exit (11); + throw new Exception (TOSTRING(__LINE__) " " __FILE__, + "Unable to create chooser list window", + APPERR_WINDOW_ERROR); chooser->init(PickView::views::Category); chooser->Show(SW_SHOW); chooser->setViewMode (!is_new_install || UpgradeAlsoOption || hasManualSelections ?
reply other threads:[~2018-01-08 14:47 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180108144740.91841.qmail@sourceware.org \ --to=kbrown@sourceware.org \ --cc=cygwin-apps-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).