* bug#37480: 27.0.50; uncaught exception
@ 2019-09-22 14:00 Christian Johansson
2019-09-22 14:50 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Christian Johansson @ 2019-09-22 14:00 UTC (permalink / raw)
To: 37480
I want to handle errors occurring in asynchronous threads like in this
example, is it possible?
(make-thread
(lambda()
(message "Start of asynchronous thread")
(signal 'error '("Fatal error"))
(message "End of asynchronous thread")))
In GNU Emacs 27.0.50 (build 5, x86_64-apple-darwin18.5.0, NS
appkit-1671.40 Version 10.14.4 (Build 18E226))
of 2019-07-12 built on Christians-MacBook-Air.local
Repository revision: 8179cbff9ed37e7d8892643859adfad448ae1c7a
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1671
System Description: Mac OS X 10.14.4
Recent messages:
Mark activated
Auto-saving...done
Quit
Saving file
/Users/christianjohansson/Documents/ownCloud/Mediastrategi/async.el...
Wrote /Users/christianjohansson/Documents/ownCloud/Mediastrategi/async.el
Quit
previous-line: Beginning of buffer
Mark set
M-g C-g is undefined
Quit
Quit
Configured features:
RSVG DBUS GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS
NS THREADS PDUMPER GMP
Important settings:
value of $LANG: en_SE.UTF-8
locale-coding-system: utf-8-unix
Major mode: Text
Minor modes in effect:
global-hl-todo-mode: t
hl-todo-mode: t
flycheck-color-mode-line-mode: t
show-paren-mode: t
save-place-mode: t
global-diff-hl-mode: t
diff-hl-mode: t
ssh-deploy-line-mode: t
global-auto-complete-mode: t
global-hl-line-mode: t
flyspell-mode: t
editorconfig-mode: t
which-key-mode: t
csv-field-index-mode: t
global-flycheck-mode: t
flycheck-mode: t
async-bytecomp-package-mode: t
yas-global-mode: t
yas-minor-mode: t
override-global-mode: t
ido-everywhere: t
display-time-mode: t
winner-mode: t
electric-pair-mode: t
recentf-mode: t
global-semantic-mru-bookmark-mode: t
global-semanticdb-minor-mode: t
global-semantic-idle-completions-mode: t
global-semantic-idle-scheduler-mode: t
global-semantic-idle-local-symbol-highlight-mode: t
global-semantic-idle-summary-mode: t
global-semantic-decoration-mode: t
global-semantic-highlight-func-mode: t
global-semantic-stickyfunc-mode: t
global-semantic-show-parser-state-mode: t
global-semantic-show-unmatched-syntax-mode: t
global-semantic-highlight-edits-mode: t
semantic-mode: t
delete-selection-mode: t
display-battery-mode: t
global-whitespace-mode: t
which-function-mode: t
shell-dirtrack-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
column-number-mode: t
transient-mark-mode: t
Load-path shadows:
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-functions
hides /Users/christianjohansson/.emacs.d/phps-mode/phps-mode-functions
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-tags
hides /Users/christianjohansson/.emacs.d/phps-mode/phps-mode-tags
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-lexer
hides /Users/christianjohansson/.emacs.d/phps-mode/phps-mode-lexer
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-macros
hides /Users/christianjohansson/.emacs.d/phps-mode/phps-mode-macros
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-semantic
hides /Users/christianjohansson/.emacs.d/phps-mode/phps-mode-semantic
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-automation
hides /Users/christianjohansson/.emacs.d/phps-mode/phps-mode-automation
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-syntax-table
hides /Users/christianjohansson/.emacs.d/phps-mode/phps-mode-syntax-table
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-flymake
hides /Users/christianjohansson/.emacs.d/phps-mode/phps-mode-flymake
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode
hides /Users/christianjohansson/.emacs.d/phps-mode/phps-mode
/Users/christianjohansson/.emacs.d/phps-mode/phps-mode-test-functions
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-test-functions
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-functions
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-functions
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-tags
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-tags
/Users/christianjohansson/.emacs.d/phps-mode/phps-mode-test-integration
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-test-integration
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-lexer
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-lexer
/Users/christianjohansson/.emacs.d/phps-mode/phps-mode-test-parser hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-test-parser
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-macros
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-macros
/Users/christianjohansson/.emacs.d/phps-mode/phps-mode-test-lexer hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-test-lexer
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-semantic
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-semantic
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-autoloads
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-autoloads
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-automation
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-automation
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-syntax-table
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-syntax-table
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-flymake
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-flymake
/Users/christianjohansson/.emacs.d/phps-mode/phps-mode-test-syntax-table
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-test-syntax-table
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode-pkg
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode-pkg
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190918.701/phps-mode
hides
/Users/christianjohansson/.emacs.d/elpa/phps-mode-20190916.1730/phps-mode
/Users/christianjohansson/.emacs.d/ssh-deploy/ssh-deploy hides
/Users/christianjohansson/.emacs.d/elpa/ssh-deploy-20181106.1347/ssh-deploy
/Users/christianjohansson/.emacs.d/ssh-deploy/ssh-deploy-diff-mode hides
/Users/christianjohansson/.emacs.d/elpa/ssh-deploy-20181106.1347/ssh-deploy-diff-mode
/Users/christianjohansson/.emacs.d/elpa/less-css-mode-20161001.453/less-css-mode
hides
/Applications/Emacs.app/Contents/Resources/lisp/textmodes/less-css-mode
/Applications/Emacs.app/Contents/Resources/lisp/progmodes/mantemp hides
/Applications/Emacs.app/Contents/Resources/lisp/obsolete/mantemp
Features:
(shadow mail-extr emacsbug sendmail help-fns cl-print debug two-column
iso-transl phps-mode-tags phps-mode-syntax-table phps-mode-semantic
phps-mode-functions phps-mode-flymake semantic/doc phps-mode-lexer
phps-mode-macros semantic/wisent semantic/wisent/wisent names edebug
backtrace tar-mode arc-mode archive-mode view package-recipe-mode
package-build-badges package-build package-recipe vc-git vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs org-rmail org-mhe org-irc org-info org-gnus
nnir gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win gnus
nnheader org-docview org-bibtex bibtex org-bbdb org-w3m
editorconfig-core editorconfig-core-handle editorconfig-fnmatch
display-line-numbers rainbow-mode hl-todo flycheck-rust
flycheck-color-mode-line face-remap cus-edit cus-start cus-load init
rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap smartparens-html
sgml-mode dom nxml-util nxml-enc xmltok misc ts-comint tss log4e helm
helm-source helm-multi-match helm-lib json-mode json-reformat
json-snatcher tide tide-lv typescript-mode zenburn-theme smarty-mode
paren saveplace mm-archive message rfc822 mml mml-sec epa derived epg
gnus-util rmail rmail-loaddefs text-property-search mailabbrev gmm-utils
mailheader gnutls network-stream url-cache restclient shackle trace smex
flycheck-pos-tip pos-tip diff-hl vc-dir ewoc vc vc-dispatcher diff-mode
exec-path-from-shell ssh-deploy-hydra ssh-deploy
emacs-wisent-grammar-converter nginx-mode ac-html ac-html-core
auto-complete-config auto-complete popup ztree ztree-diff
ztree-diff-model ztree-dir ztree-view ztree-util gulp-task-runner grunt
powerline powerline-separators powerline-themes phpcbf
php-auto-yasnippets php-mode php-project add-log cc-langs web-beautify
w3m doc-view jka-compr dired dired-loaddefs image-mode timezone w3m-hist
w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc
w3m-util hydra lv imenu-list hl-line auto-dictionary flyspell ispell
editorconfig ansible-doc org-jira org-jira-sdk jiralib request
mail-utils soap-client mm-decode mm-bodies mm-encode url-http url-auth
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw
nsm rmc puny rng-xsd rng-dt rng-util xsd-regexp xml org-clock
org-element avl-tree smartparens-org org org-macro org-footnote
org-pcomplete org-list org-faces org-entities time-date org-version
ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs cal-menu
calendar cal-loaddefs ecb ecb-symboldef ecb-analyse ecb-compatibility
ecb-winman-support ecb-autogen autoload radix-tree ecb-tod ecb-cycle
ecb-eshell ecb-help ecb-jde ecb-method-browser hideshow
ecb-semantic-wrapper ecb-semantic ecb-file-browser ecb-speedbar
ecb-layout ecb-create-layout ecb-compilation ecb-common-browser speedbar
sb-image dframe ecb-navigate eieio-compat ecb-mode-line ecb-face
tree-buffer ecb-upgrade ecb-cedet-wrapper semantic/db-find
semantic/db-ref ecb-util which-key csv-mode sort flycheck-package
package-lint finder finder-inf lisp-mnt flycheck flymake-rust
flymake-easy flymake-proc flymake warnings rust-playground time-stamp
cargo cargo-process smartparens-markdown markdown-mode color noutline
outline smartparens-rust rust-mode image+ image-file google-translate
google-translate-default-ui google-translate-core-ui
google-translate-core google-translate-tk url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf mailcap
lorem-ipsum darktooth-theme autothemer smartparens-config
smartparens-javascript smartparens-text smartparens paredit ripgrep
thingatpt grep compile minimap skewer-mode cache-table js2-mode etags
fileloop generator xref project js cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs simple-httpd pp
url-util doom-themes doom-themes-common base16-theme dracula-theme
with-editor async-bytecomp async server yasnippet yaxception ht dash
know-your-http-well http-status-codes http-relations http-methods
http-headers s use-package up-delight up-diminish up-ensure up-core
pcase cl bind-key easy-mmode ido time winner elec-pair desktop frameset
recentf tree-widget wid-edit semantic/mru-bookmark semantic/db-mode
semantic/idle semantic/analyze semantic/sort semantic/scope
semantic/analyze/fcn semantic/db eieio-base semantic/format ezimage
semantic/ctxt semantic/decorate/mode semantic/tag-ls semantic/find
semantic/decorate pulse semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local find-func cedet edmacro
kmacro delsel battery disp-table whitespace which-func imenu windmove
tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat
shell pcomplete comint ansi-color ring parse-time ls-lisp format-spec
wombat-theme rx cl-extra help-mode advice info package easymenu
epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win
ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow
isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind kqueue cocoa ns
multi-tty make-network-process emacs)
Memory information:
((conses 16 752194 242623)
(symbols 48 61091 23)
(strings 32 234066 45399)
(string-bytes 1 7200853)
(vectors 16 92145)
(vector-slots 8 1768635 188454)
(floats 8 768 1432)
(intervals 56 5603 3108)
(buffers 992 34))
--
Hälsningar / Best Regards
Christian
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37480: 27.0.50; uncaught exception
2019-09-22 14:00 bug#37480: 27.0.50; uncaught exception Christian Johansson
@ 2019-09-22 14:50 ` Eli Zaretskii
2019-09-22 15:26 ` Christian Johansson
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2019-09-22 14:50 UTC (permalink / raw)
To: Christian Johansson; +Cc: 37480
> From: Christian Johansson <christian@cvj.se>
> Date: Sun, 22 Sep 2019 16:00:38 +0200
>
> I want to handle errors occurring in asynchronous threads like in this
> example, is it possible?
For some value of "possible". From the ELisp manual:
When code run by a thread signals an error that is unhandled, the
thread exits. Other threads can access the error form which caused the
thread to exit using the following function.
-- Function: thread-last-error
This function returns the last error form recorded when a thread
exited due to an error. Each thread that exits abnormally
overwrites the form stored by the previous thread’s error with a
new value, so only the last one can be accessed.
> (make-thread
> (lambda()
> (message "Start of asynchronous thread")
> (signal 'error '("Fatal error"))
> (message "End of asynchronous thread")))
I'm not sure I understand what you tried to accomplish with this code.
It doesn't seem to handle errors in any way. Could you explain what
you are trying to do?
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37480: 27.0.50; uncaught exception
2019-09-22 14:50 ` Eli Zaretskii
@ 2019-09-22 15:26 ` Christian Johansson
2019-09-22 15:39 ` Eli Zaretskii
2019-09-22 16:53 ` Michael Albinus
0 siblings, 2 replies; 10+ messages in thread
From: Christian Johansson @ 2019-09-22 15:26 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 37480
Hi!
Alright, I would like to do something like this:
(condition-case
nil
(make-thread
(lambda()
(message "Start of asynchronous thread")
(signal 'error '("Fatal error"))
(message "End of asynchronous thread")))
(message "Catched error"))
I have a case were a error occurs inside a tramp thread and I would like
to be able to handle it
Hälsningar / Best Regards
Christian
On 2019-09-22 16:50, Eli Zaretskii wrote:
>> From: Christian Johansson <christian@cvj.se>
>> Date: Sun, 22 Sep 2019 16:00:38 +0200
>>
>> I want to handle errors occurring in asynchronous threads like in this
>> example, is it possible?
> For some value of "possible". From the ELisp manual:
>
> When code run by a thread signals an error that is unhandled, the
> thread exits. Other threads can access the error form which caused the
> thread to exit using the following function.
>
> -- Function: thread-last-error
> This function returns the last error form recorded when a thread
> exited due to an error. Each thread that exits abnormally
> overwrites the form stored by the previous thread’s error with a
> new value, so only the last one can be accessed.
>
>> (make-thread
>> (lambda()
>> (message "Start of asynchronous thread")
>> (signal 'error '("Fatal error"))
>> (message "End of asynchronous thread")))
> I'm not sure I understand what you tried to accomplish with this code.
> It doesn't seem to handle errors in any way. Could you explain what
> you are trying to do?
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37480: 27.0.50; uncaught exception
2019-09-22 15:26 ` Christian Johansson
@ 2019-09-22 15:39 ` Eli Zaretskii
2019-09-23 5:18 ` Christian Johansson
2019-09-22 16:53 ` Michael Albinus
1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2019-09-22 15:39 UTC (permalink / raw)
To: Christian Johansson; +Cc: 37480
> Cc: 37480@debbugs.gnu.org
> From: Christian Johansson <christian@cvj.se>
> Date: Sun, 22 Sep 2019 17:26:28 +0200
>
> (condition-case
> nil
> (make-thread
> (lambda()
> (message "Start of asynchronous thread")
> (signal 'error '("Fatal error"))
> (message "End of asynchronous thread")))
> (message "Catched error"))
>
> I have a case were a error occurs inside a tramp thread and I would like
> to be able to handle it
You don't need condition-case in this case, you just need to examine
the value of thread-last-error when the thread exits.
Alternatively, you could try making the thread you start signal the
main thread, then the main thread should be able to catch that error.
In general, errors are thread-local, so you cannot catch an error
signaled in another thread.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37480: 27.0.50; uncaught exception
2019-09-22 15:39 ` Eli Zaretskii
@ 2019-09-23 5:18 ` Christian Johansson
2019-09-23 7:14 ` Michael Albinus
2019-09-23 16:37 ` Eli Zaretskii
0 siblings, 2 replies; 10+ messages in thread
From: Christian Johansson @ 2019-09-23 5:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 37480
Hi
Alright, I didn't know about that function. Can you give an example of
how to use it? It tried the following but it doesn't work, it seems the
thread dies after the signal and I'm not sure were it exits.
(make-thread
(lambda()
(message "Start of asynchronous thread")
(signal 'error '("Fatal error"))
(message "End of asynchronous thread")
(message "Last error %s" (thread-last-error))))
For my ssh-deploy plugin, sometimes a asynchronous process or thread
gets an error, could be network issues for instance and I would like to
be able to handle these cases. I'm trying to make sure there is only one
asynchronous process or thread simultaneously related to a local file,
this is to avoid race conditions that otherwise occur with my plugin,
especially when on a bad connection.
I would be interested in exploring how to signal the main thread from
the created thread, where can I read more about that?
Hälsningar / Best Regards
Christian
On 2019-09-22 17:39, Eli Zaretskii wrote:
>> Cc: 37480@debbugs.gnu.org
>> From: Christian Johansson <christian@cvj.se>
>> Date: Sun, 22 Sep 2019 17:26:28 +0200
>>
>> (condition-case
>> nil
>> (make-thread
>> (lambda()
>> (message "Start of asynchronous thread")
>> (signal 'error '("Fatal error"))
>> (message "End of asynchronous thread")))
>> (message "Catched error"))
>>
>> I have a case were a error occurs inside a tramp thread and I would like
>> to be able to handle it
> You don't need condition-case in this case, you just need to examine
> the value of thread-last-error when the thread exits.
>
> Alternatively, you could try making the thread you start signal the
> main thread, then the main thread should be able to catch that error.
>
> In general, errors are thread-local, so you cannot catch an error
> signaled in another thread.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37480: 27.0.50; uncaught exception
2019-09-23 5:18 ` Christian Johansson
@ 2019-09-23 7:14 ` Michael Albinus
2019-09-23 16:37 ` Eli Zaretskii
1 sibling, 0 replies; 10+ messages in thread
From: Michael Albinus @ 2019-09-23 7:14 UTC (permalink / raw)
To: Christian Johansson; +Cc: 37480
Christian Johansson <christian@cvj.se> writes:
> Hi
Hi Christian,
> Alright, I didn't know about that function. Can you give an example of
> how to use it?
See .../test/src/thread-tests.el, function threads-errors.
> I would be interested in exploring how to signal the main thread from
> the created thread, where can I read more about that?
thread-signal does NOT raise an error if the target thread is the main
thread. You see just the message.
See .../test/src/thread-tests.el, function threads-signal-main-thread.
If you want a signal to be propagated to the main thread, you must
organise differently. For example checking thread-last-error, when the
main thread gets control.
> Hälsningar / Best Regards
> Christian
Best regards, Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37480: 27.0.50; uncaught exception
2019-09-23 5:18 ` Christian Johansson
2019-09-23 7:14 ` Michael Albinus
@ 2019-09-23 16:37 ` Eli Zaretskii
2019-09-24 3:16 ` Christian Johansson
1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2019-09-23 16:37 UTC (permalink / raw)
To: Christian Johansson; +Cc: 37480
> Cc: 37480@debbugs.gnu.org
> From: Christian Johansson <christian@cvj.se>
> Date: Mon, 23 Sep 2019 07:18:25 +0200
>
> Alright, I didn't know about that function. Can you give an example of
> how to use it? It tried the following but it doesn't work, it seems the
> thread dies after the signal and I'm not sure were it exits.
>
> (make-thread
> (lambda()
> (message "Start of asynchronous thread")
> (signal 'error '("Fatal error"))
> (message "End of asynchronous thread")
> (message "Last error %s" (thread-last-error))))
This function is supposed to be used by a thread other than the one
that hit the error.
> For my ssh-deploy plugin, sometimes a asynchronous process or thread
> gets an error, could be network issues for instance and I would like to
> be able to handle these cases.
If you want to handle the error in the thread which gets the error,
just use condition-case or similar construct in that thread. If you
want to handle the error in another thread, thread-last-error is for
you.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37480: 27.0.50; uncaught exception
2019-09-23 16:37 ` Eli Zaretskii
@ 2019-09-24 3:16 ` Christian Johansson
0 siblings, 0 replies; 10+ messages in thread
From: Christian Johansson @ 2019-09-24 3:16 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 37480
Ok thanks, now I understand
23 sep. 2019 kl. 18:37 skrev Eli Zaretskii <eliz@gnu.org>:
>> Cc: 37480@debbugs.gnu.org
>> From: Christian Johansson <christian@cvj.se>
>> Date: Mon, 23 Sep 2019 07:18:25 +0200
>>
>> Alright, I didn't know about that function. Can you give an example of
>> how to use it? It tried the following but it doesn't work, it seems the
>> thread dies after the signal and I'm not sure were it exits.
>>
>> (make-thread
>> (lambda()
>> (message "Start of asynchronous thread")
>> (signal 'error '("Fatal error"))
>> (message "End of asynchronous thread")
>> (message "Last error %s" (thread-last-error))))
>
> This function is supposed to be used by a thread other than the one
> that hit the error.
>
>> For my ssh-deploy plugin, sometimes a asynchronous process or thread
>> gets an error, could be network issues for instance and I would like to
>> be able to handle these cases.
>
> If you want to handle the error in the thread which gets the error,
> just use condition-case or similar construct in that thread. If you
> want to handle the error in another thread, thread-last-error is for
> you.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37480: 27.0.50; uncaught exception
2019-09-22 15:26 ` Christian Johansson
2019-09-22 15:39 ` Eli Zaretskii
@ 2019-09-22 16:53 ` Michael Albinus
2019-11-07 4:25 ` Stefan Kangas
1 sibling, 1 reply; 10+ messages in thread
From: Michael Albinus @ 2019-09-22 16:53 UTC (permalink / raw)
To: Christian Johansson; +Cc: 37480
Christian Johansson <christian@cvj.se> writes:
> Hi!
Hi Christian,
> I have a case were a error occurs inside a tramp thread and I would
> like to be able to handle it
Could you give more details on the error inside a tramp thread? I'm
interested in.
Furthermore, Tramp in its own repository (not Emacs master) has more
support for threads. This includes better reports about errors inside
threads.
Hmm, maybe I shall sync this with the feature/tramp-thread-safe branch ...
> Hälsningar / Best Regards
> Christian
Best regards, Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37480: 27.0.50; uncaught exception
2019-09-22 16:53 ` Michael Albinus
@ 2019-11-07 4:25 ` Stefan Kangas
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Kangas @ 2019-11-07 4:25 UTC (permalink / raw)
To: Michael Albinus; +Cc: Christian Johansson, 37480
tags 37480 + moreinfo
close 37480
thanks
Michael Albinus <michael.albinus@gmx.de> writes:
> Christian Johansson <christian@cvj.se> writes:
>
>> Hi!
>
> Hi Christian,
>
>> I have a case were a error occurs inside a tramp thread and I would
>> like to be able to handle it
>
> Could you give more details on the error inside a tramp thread? I'm
> interested in.
>
> Furthermore, Tramp in its own repository (not Emacs master) has more
> support for threads. This includes better reports about errors inside
> threads.
>
> Hmm, maybe I shall sync this with the feature/tramp-thread-safe branch ...
More information was requested, but none was given within 6 weeks, so
I'm closing this bug. The rest of the discussion was clarifications
on how to use threads.
If there is still an issue here, please reopen the bug report.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-11-07 4:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-22 14:00 bug#37480: 27.0.50; uncaught exception Christian Johansson
2019-09-22 14:50 ` Eli Zaretskii
2019-09-22 15:26 ` Christian Johansson
2019-09-22 15:39 ` Eli Zaretskii
2019-09-23 5:18 ` Christian Johansson
2019-09-23 7:14 ` Michael Albinus
2019-09-23 16:37 ` Eli Zaretskii
2019-09-24 3:16 ` Christian Johansson
2019-09-22 16:53 ` Michael Albinus
2019-11-07 4:25 ` Stefan Kangas
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).