public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 8/9] Fix useless error message
Date: Tue, 06 Jun 2017 11:55:00 -0000	[thread overview]
Message-ID: <20170606115432.105020-9-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20170606115432.105020-1-jon.turney@dronecode.org.uk>

If source.Cached() is empty, we produce the amazingly helpful error message
"Can't open (null) for reading: No such file".

Improve the error message so it reports that we can't open the archive since
we don't know a filename for the locally cached archive file.

This can occur if download failed for an archive, but we chose to continue.
---
 install.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/install.cc b/install.cc
index 79ddd20..f8f0b59 100644
--- a/install.cc
+++ b/install.cc
@@ -366,7 +366,14 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
 
   io_stream *pkgfile = NULL;
 
-  if (!source.Cached() || !io_stream::exists (source.Cached ())
+  if (!source.Cached())
+    {
+      note (NULL, IDS_ERR_OPEN_READ, source.Canonical (), "Unknown filename");
+      ++errors;
+      return;
+    }
+
+  if (!io_stream::exists (source.Cached ())
       || !(pkgfile = io_stream::open (source.Cached (), "rb", 0)))
     {
       note (NULL, IDS_ERR_OPEN_READ, source.Cached (), "No such file");
-- 
2.12.3

      parent reply	other threads:[~2017-06-06 11:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 11:54 [PATCH setup 0/9] Setup patches Jon Turney
2017-06-06 11:54 ` [PATCH setup 4/9] Add Option::isPresent() method Jon Turney
2017-06-06 11:54 ` [PATCH setup 2/9] Alphabetically sort options in usage help Jon Turney
2017-06-06 11:55 ` [PATCH setup 6/9] Allow click-to-activate in PickView list control Jon Turney
2017-06-06 11:55 ` [PATCH setup 1/9] Allow options which only have long names Jon Turney
2017-06-06 11:55 ` [PATCH setup 3/9] Access StringOption's value by reference Jon Turney
2017-06-06 11:55 ` [PATCH setup 7/9] Fix that clicking on any column changes "Keep" to "Uninstall" Jon Turney
2017-06-06 11:55 ` [PATCH setup 9/9] Avoid messagebox spam with file:// protocol URLs Jon Turney
2017-06-06 11:55 ` [PATCH setup 5/9] Allow user-agent string to be customized Jon Turney
2017-06-06 11:55 ` Jon Turney [this message]

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=20170606115432.105020-9-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /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: link
Be 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).