* Defining functions within `condition-case'
@ 2024-12-25 10:37 Jean Louis
2024-12-25 19:57 ` Michael Heerdegen via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 3+ messages in thread
From: Jean Louis @ 2024-12-25 10:37 UTC (permalink / raw)
To: Help GNU Emacs
Is there any argument against following notion:
;; -*- lexical-binding: t; -*-
(condition-case my
(defun my-2-hello ()
(message "I am `my-hello'"))
(error (message "%s" my)))
(my-2-hello) ➜ "I am ‘my-hello’"
I am testing it, it seems that it works.
The reason for this is website application development. I would like
to ensure that, in case of any errors, I can access a function to
inform me what went wrong. These errors should be presented over an
HTTP connection, and I do not intend to inspect them through Emacs
directly.
Jean Louis
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Defining functions within `condition-case'
2024-12-25 10:37 Defining functions within `condition-case' Jean Louis
@ 2024-12-25 19:57 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-12-26 11:19 ` Jean Louis
0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-12-25 19:57 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> ;; -*- lexical-binding: t; -*-
>
> (condition-case my
>
> (defun my-2-hello ()
> (message "I am `my-hello'"))
>
> (error (message "%s" my)))
>
> (my-2-hello) ➜ "I am ‘my-hello’"
You are aware that this doesn't catch runtime errors, only errors that
appear when evaluating the `defun'? The above will not be of much use
unless your code contains lots of very strange and malformed defuns like
(defun 1).
Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Defining functions within `condition-case'
2024-12-25 19:57 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-12-26 11:19 ` Jean Louis
0 siblings, 0 replies; 3+ messages in thread
From: Jean Louis @ 2024-12-26 11:19 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs
* Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2024-12-25 22:57]:
> Jean Louis <bugs@gnu.support> writes:
>
> > ;; -*- lexical-binding: t; -*-
> >
> > (condition-case my
> >
> > (defun my-2-hello ()
> > (message "I am `my-hello'"))
> >
> > (error (message "%s" my)))
> >
> > (my-2-hello) ➜ "I am ‘my-hello’"
>
> You are aware that this doesn't catch runtime errors, only errors that
> appear when evaluating the `defun'? The above will not be of much use
> unless your code contains lots of very strange and malformed defuns like
> (defun 1).
I am not aware how it works, did not do enough testing 🤔.
I will not use that approach, but must find way to report error on
HTTP or in HTTP manner, not within Emacs.
Is there way to replace debug reporting function?
--
Jean Louis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-26 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-25 10:37 Defining functions within `condition-case' Jean Louis
2024-12-25 19:57 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-12-26 11:19 ` Jean Louis
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).