Skip to content

aki2o/yaxception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What's this?

This is a extension of Emacs provides framework about exception like Java for Elisp.

Feature

Grammar like Java's try/catch/finally/throw

You can write like the following about exception.

(yaxception:$
  (yaxception:try
    (delete-file "not found"))
  (yaxception:catch 'file-error e
    (message "Error happened by handling file : %s" (yaxception:get-text e)))
  (yaxception:catch 'error e
    (message "Error happened by something : %s" (yaxception:get-text e))
    (yaxception:throw e))
  (yaxception:finally
    (message "finished doing")))

Stacktrace like Java

If want to get stacktrace, the way is only getting the buffer named "\*Backtrace\*" as far as I know.
But it has some bad points. List them at the following …

  • It need (setq debug-on-error t).
  • The buffer has trouble for seeing its stacktrace because all of function/special-form shown.
  • Can't get string of stacktrace without popup the buffer.

So, it's enabled that you get the string of stacktrace easy for seeing.
For example, if you write the following.

(defun aaa (aa bb &optional cc) (bbb bb))
(defun bbb (bb) (ccc))
(defun ccc () (replace-regexp-in-string " " "" 'hogege))
(defun xxx (zzz) "xxx")
(defun yyy () "yyy")

(yaxception:$
  (yaxception:try
    (xxx "hoge")
    (yyy)
    (aaa "ABC" "DEF" '("GHI" "JKL")))
  (yaxception:catch 'error e
    (message "%s" (yaxception:get-stack-trace-string e))))

Then, output the following.

Exception is 'wrong-type-argument'. Wrong type argument: sequencep, hogege
  at replace-regexp-in-string(\" \" \"\" hogege)
  at ccc()
  at bbb(\"DEF\")
  at aaa(\"ABC\" \"DEF\" (\"GHI\" \"JKL\"))
  in yaxception:try

List function only.
I want to list macro, but I don't know the way that discriminate macro from builtin special-form.

Enjoy!!!

About

Provide a framework of exception like Java for elisp

Resources

Stars

Watchers

Forks

Packages

No packages published