错误处理
抛出错误
(signal 'my-error '("This is a demo error"))
(error "This is another error")
What's the difference between the two?
捕获错误
(progn
(condition-case err
(signal 'my-error '("This is a demo error"))
('my-error (message "my error handled, %s" err)))
(message "end"))
(defun aaa ()
(interactive)
(condition-case error
(progn
(op/git-change-branch op/repository-directory "source")
(op/git-commit-changes op/repository-directory "Changes"))
'('git-error (message "Error is %s" error))))
(aaa)
忽略错误
(progn
(ignore-errors
;;(signal 'my-error '("This is a demo error"))
(error "This is another error")
)
(message "end"))