unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53762: Improve error message when during url retrieving network connection is lost
@ 2022-02-03 19:30 emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-04  9:50 ` Robert Pluim
  0 siblings, 1 reply; 8+ messages in thread
From: emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-03 19:30 UTC (permalink / raw)
  To: 53762

Sometimes when fetching an URL with url-retireve emacs
returns the error "Process <URL> not running"

This is the case when emacs tries to do an operation
on the process and finds the process is not running anymore.

In case of fetching an url it is presumably because of
the network connection is unexpectedly lost, so for network
processes returning an error message like "Network connection
closed unexpectedly" or similar is more informative for the
user than saying "Process X not running".






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53762: Improve error message when during url retrieving network connection is lost
  2022-02-03 19:30 bug#53762: Improve error message when during url retrieving network connection is lost emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-04  9:50 ` Robert Pluim
  2022-02-05  6:57   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Pluim @ 2022-02-04  9:50 UTC (permalink / raw)
  To: 53762; +Cc: emacsq

>>>>> On Thu, 03 Feb 2022 19:30:31 +0000, emacsq via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> said:

    emacsq> Sometimes when fetching an URL with url-retireve emacs
    emacsq> returns the error "Process <URL> not running"

    emacsq> This is the case when emacs tries to do an operation
    emacsq> on the process and finds the process is not running anymore.

    emacsq> In case of fetching an url it is presumably because of
    emacsq> the network connection is unexpectedly lost, so for network
    emacsq> processes returning an error message like "Network connection
    emacsq> closed unexpectedly" or similar is more informative for the
    emacsq> user than saying "Process X not running".

Does something like this do the trick? Iʼve not been able to get a
reliable test case for it yet.

diff --git a/src/process.c b/src/process.c
index 7c7f608284..18d4579dba 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6424,7 +6424,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
   if (p->raw_status_new)
     update_status (p);
   if (! EQ (p->status, Qrun))
-    error ("Process %s not running", SDATA (p->name));
+    error ("Process %s %s", SDATA (p->name), SDATA (status_message (p)));
   if (p->outfd < 0)
     error ("Output file descriptor of %s is closed", SDATA (p->name));
 
@@ -7129,7 +7129,7 @@ DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0,
   if (XPROCESS (proc)->raw_status_new)
     update_status (XPROCESS (proc));
   if (! EQ (XPROCESS (proc)->status, Qrun))
-    error ("Process %s not running", SDATA (XPROCESS (proc)->name));
+    error ("Process %s %s", SDATA (XPROCESS (proc)->name), SDATA (status_message (XPROCESS (proc))));
 
   if (coding && CODING_REQUIRE_FLUSHING (coding))
     {





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#53762: Improve error message when during url retrieving network connection is lost
  2022-02-04  9:50 ` Robert Pluim
@ 2022-02-05  6:57   ` Lars Ingebrigtsen
  2022-02-07 13:56     ` Robert Pluim
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-05  6:57 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 53762, emacsq

Robert Pluim <rpluim@gmail.com> writes:

> Does something like this do the trick? Iʼve not been able to get a
> reliable test case for it yet.

[...]

>    if (! EQ (p->status, Qrun))
> -    error ("Process %s not running", SDATA (p->name));
> +    error ("Process %s %s", SDATA (p->name), SDATA (status_message (p)));

I think that's probably an improvement over what we have now, but I
don't really have a good test case, either.  But perhaps "not running"
should be kept, and the status message just be appended?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53762: Improve error message when during url retrieving network connection is lost
  2022-02-05  6:57   ` Lars Ingebrigtsen
@ 2022-02-07 13:56     ` Robert Pluim
  2022-02-07 16:48       ` emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Pluim @ 2022-02-07 13:56 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53762, emacsq

>>>>> On Sat, 05 Feb 2022 07:57:31 +0100, Lars Ingebrigtsen <larsi@gnus.org> said:

    Lars> Robert Pluim <rpluim@gmail.com> writes:
    >> Does something like this do the trick? Iʼve not been able to get a
    >> reliable test case for it yet.

    Lars> [...]

    >> if (! EQ (p->status, Qrun))
    >> -    error ("Process %s not running", SDATA (p->name));
    >> +    error ("Process %s %s", SDATA (p->name), SDATA (status_message (p)));

    Lars> I think that's probably an improvement over what we have now, but I
    Lars> don't really have a good test case, either.  But perhaps "not running"
    Lars> should be kept, and the status message just be appended?

Sure, that can be done. Does the patch actually solve the problem,
emacsq?

Robert
-- 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53762: Improve error message when during url retrieving network connection is lost
  2022-02-07 13:56     ` Robert Pluim
@ 2022-02-07 16:48       ` emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-08  8:40         ` Robert Pluim
  0 siblings, 1 reply; 8+ messages in thread
From: emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-07 16:48 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 53762, Lars Ingebrigtsen

> Sure, that can be done. Does the patch actually solve the problem,
emacsq?

We have information if it's a network connection: if (NETCONN_P (proc))

So using that we can improve the message. Something like:

if (NETCONN_P (proc))
  "Network error: <process> <error message>"
else
  "Process <process> not running: <error message>"







^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53762: Improve error message when during url retrieving network connection is lost
  2022-02-07 16:48       ` emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-08  8:40         ` Robert Pluim
  2022-02-08 21:50           ` emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Pluim @ 2022-02-08  8:40 UTC (permalink / raw)
  To: emacsq; +Cc: 53762, Lars Ingebrigtsen

>>>>> On Mon, 07 Feb 2022 16:48:57 +0000, emacsq via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> said:

    >> Sure, that can be done. Does the patch actually solve the problem,
    emacsq> emacsq?

    emacsq> We have information if it's a network connection: if (NETCONN_P (proc))

    emacsq> So using that we can improve the message. Something like:

    emacsq> if (NETCONN_P (proc))
    emacsq>   "Network error: <process> <error message>"
    emacsq> else
    emacsq>   "Process <process> not running: <error message>"

`status_message' already produces different messages based on whether
itʼs a network connection, so I donʼt think thatʼs necessary.

Have you been able to try the original patch? I now realise that
youʼre on windows, which explains why you were seeing problems
originally.

Robert
-- 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53762: Improve error message when during url retrieving network connection is lost
  2022-02-08  8:40         ` Robert Pluim
@ 2022-02-08 21:50           ` emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-03-16 17:59             ` Robert Pluim
  0 siblings, 1 reply; 8+ messages in thread
From: emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-08 21:50 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 53762, Lars Ingebrigtsen

> `status_message' already produces different messages based on whether
itʼs a network connection, so I donʼt think thatʼs necessary.

Sounds good. I don't have a C compilation environment set up on
windows to try the patch, but it's an improvement over the current
message, so AFAIC this bug can be closed with this fix.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53762: Improve error message when during url retrieving network connection is lost
  2022-02-08 21:50           ` emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-03-16 17:59             ` Robert Pluim
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Pluim @ 2022-03-16 17:59 UTC (permalink / raw)
  To: emacsq; +Cc: 53762, Lars Ingebrigtsen

tags 53762 fixed
close 53762 29.1
quit

>>>>> On Tue, 08 Feb 2022 21:50:07 +0000, emacsq <laszlomail@protonmail.com> said:

    >> `status_message' already produces different messages based on whether
    emacsq> itʼs a network connection, so I donʼt think thatʼs necessary.

    emacsq> Sounds good. I don't have a C compilation environment set up on
    emacsq> windows to try the patch, but it's an improvement over the current
    emacsq> message, so AFAIC this bug can be closed with this fix.

Closing.
Committed as fa8c93ad9a





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-16 17:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 19:30 bug#53762: Improve error message when during url retrieving network connection is lost emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-04  9:50 ` Robert Pluim
2022-02-05  6:57   ` Lars Ingebrigtsen
2022-02-07 13:56     ` Robert Pluim
2022-02-07 16:48       ` emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-08  8:40         ` Robert Pluim
2022-02-08 21:50           ` emacsq via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-16 17:59             ` Robert Pluim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).