Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gsll
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
antik
gsll
Commits
9969bdf7
Commit
9969bdf7
authored
9 years ago
by
Liam M. Healy
Browse files
Options
Downloads
Patches
Plain Diff
New macro #'return-value-on-error
parent
95db48a3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
init/conditions.lisp
+15
-2
15 additions, 2 deletions
init/conditions.lisp
with
15 additions
and
2 deletions
init/conditions.lisp
+
15
−
2
View file @
9969bdf7
;; GSL errors
;; GSL errors
;; Liam Healy Sat Mar 4 2006 - 18:33
;; Liam Healy Sat Mar 4 2006 - 18:33
;; Time-stamp: <201
0
-0
7-20 17:55:56
EDT conditions.lisp>
;; Time-stamp: <201
5
-0
6-02 17:38:15
EDT conditions.lisp>
;;
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Copyright 2006, 2007, 2008, 2009
, 2010, 2015
Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;; Distributed under the terms of the GNU General Public License
;;
;;
;; This program is free software: you can redistribute it and/or modify
;; This program is free software: you can redistribute it and/or modify
...
@@ -182,3 +182,16 @@
...
@@ -182,3 +182,16 @@
;;; This insures that conditions will be signalled if GSLL is dumped
;;; This insures that conditions will be signalled if GSLL is dumped
;;; in save-lisp-and-die.
;;; in save-lisp-and-die.
#+
sbcl
(
push
'establish-handler
sb-ext:*init-hooks*
)
#+
sbcl
(
push
'establish-handler
sb-ext:*init-hooks*
)
;;; Convenience macro so user can specify a value to return for a particular error.
(
export
'return-value-on-error
)
(
defmacro
return-value-on-error
(
values
error
&body
body
)
"Return the value(s) (a value or list of values) in case the specified GSL error is signalled in the body."
`
(
restart-case
(
handler-bind
((
,
error
#'
(
lambda
(
condition
)
(
declare
(
ignore
condition
))
(
invoke-restart
'return
,@
(
alexandria:ensure-list
values
)))))
,@
body
)
(
return
(
&rest
v
)
(
apply
'values
v
))))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment