* Odd backtrace in condition-case
@ 2019-05-20 17:26 Lars Ingebrigtsen
2019-05-20 17:50 ` Lars Ingebrigtsen
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-05-20 17:26 UTC (permalink / raw)
To: emacs-devel
I usually run with `debug-on-error' set, but lately I've started getting
these backtraces:
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
capitalize(nil)
timezone-make-arpa-date(2000 0 0 "01:00:00" (3600 "CET"))
timezone-make-date-arpa-standard("Session")
date-to-time("Session")
url-cookie-expired-p([url-cookie "NRK-Experiment-Bucket" "0" "Session" "/" "www.nrk.no" nil])
[...]
url-http-create-request()
url-http-async-sentinel(#<process www.nrk.no> "open\n")
The code is:
(defun url-cookie-expired-p (cookie)
"Return non-nil if COOKIE is expired."
(let ((exp (url-cookie-expires cookie)))
(and (> (length exp) 0)
(condition-case ()
(time-less-p (date-to-time exp) nil)
(error nil)))))
My question is: Why does this give me a backtrace?
If I say something else, like:
(condition-case ()
(capitalize nil)
(error t))
=> t
I get no backtrace, but:
(condition-case ()
(date-to-time "Session")
(error t))
=>
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
capitalize(nil)
timezone-make-arpa-date(2000 0 0 "01:00:00" (3600 "CET"))
timezone-make-date-arpa-standard("Session")
date-to-time("Session")
(condition-case nil (date-to-time "Session") (error nil))
*scratches head*
Shouldn't the `error' clause in condition-case catch all errors?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Odd backtrace in condition-case
2019-05-20 17:26 Odd backtrace in condition-case Lars Ingebrigtsen
@ 2019-05-20 17:50 ` Lars Ingebrigtsen
2019-05-20 18:22 ` Andy Moreton
2019-05-21 21:51 ` Stefan Monnier
2 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-05-20 17:50 UTC (permalink / raw)
To: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> (condition-case ()
> (date-to-time "Session")
> (error t))
Oh. The function in question has:
(condition-case-unless-debug err
(encode-time (parse-time-string
(timezone-make-date-arpa-standard date)))
Checked in by Stefan in April. Stefan, was that checked in by mistake?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Odd backtrace in condition-case
2019-05-20 17:26 Odd backtrace in condition-case Lars Ingebrigtsen
2019-05-20 17:50 ` Lars Ingebrigtsen
@ 2019-05-20 18:22 ` Andy Moreton
2019-05-21 15:16 ` Paul Eggert
2019-05-21 21:51 ` Stefan Monnier
2 siblings, 1 reply; 5+ messages in thread
From: Andy Moreton @ 2019-05-20 18:22 UTC (permalink / raw)
To: emacs-devel
On Mon 20 May 2019, Lars Ingebrigtsen wrote:
> I usually run with `debug-on-error' set, but lately I've started getting
> these backtraces:
> Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
> capitalize(nil)
> timezone-make-arpa-date(2000 0 0 "01:00:00" (3600 "CET"))
> timezone-make-date-arpa-standard("Session")
> date-to-time("Session")
> (condition-case nil (date-to-time "Session") (error nil))
> Shouldn't the `error' clause in condition-case catch all errors?
`date-to-time' has:
(condition-case-unless-debug err
(encode-time (parse-time-string
(timezone-make-date-arpa-standard date)))
As you have `debug-on-error' set, this looks like the expected
behaviour.
The `condition-case-unless-debug' was added by Stefan in commit
cb411c609d43 on April 19th. Perhaps this is left over debugging code ?
AndyM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Odd backtrace in condition-case
2019-05-20 18:22 ` Andy Moreton
@ 2019-05-21 15:16 ` Paul Eggert
0 siblings, 0 replies; 5+ messages in thread
From: Paul Eggert @ 2019-05-21 15:16 UTC (permalink / raw)
To: Andy Moreton; +Cc: emacs-devel
On 5/20/19 11:22 AM, Andy Moreton wrote:
> The `condition-case-unless-debug' was added by Stefan in commit
> cb411c609d43 on April 19th. Perhaps this is left over debugging code ?
Yes, that's evidently what happened. I just now patched master to change
it back to plain 'condition-case'. The problem was partly my fault,
since I introduced the date-to-time bug that Stefan fixed in April.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Odd backtrace in condition-case
2019-05-20 17:26 Odd backtrace in condition-case Lars Ingebrigtsen
2019-05-20 17:50 ` Lars Ingebrigtsen
2019-05-20 18:22 ` Andy Moreton
@ 2019-05-21 21:51 ` Stefan Monnier
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2019-05-21 21:51 UTC (permalink / raw)
To: emacs-devel
> I usually run with `debug-on-error' set, but lately I've started getting
> these backtraces:
>
> Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
> capitalize(nil)
> timezone-make-arpa-date(2000 0 0 "01:00:00" (3600 "CET"))
> timezone-make-date-arpa-standard("Session")
> date-to-time("Session")
> url-cookie-expired-p([url-cookie "NRK-Experiment-Bucket" "0" "Session" "/" "www.nrk.no" nil])
FWIW, I think it was useful for Emacs to show this backtrace (hence
validating the use of condition-case-unless-debug there ;-) because
it makes no sense for
(date-to-time "Session")
to signal the error `(wrong-type-argument char-or-string-p nil)`
IOW, the above backtrace indicates a bug somewhere within date-to-time,
which should signal *another* error.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-21 21:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-20 17:26 Odd backtrace in condition-case Lars Ingebrigtsen
2019-05-20 17:50 ` Lars Ingebrigtsen
2019-05-20 18:22 ` Andy Moreton
2019-05-21 15:16 ` Paul Eggert
2019-05-21 21:51 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.