Skip to content

Commit

Permalink
Deprecate ignoring (per #62)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruricolist committed Jan 9, 2022
1 parent 7c9314e commit 3bc682d
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions conditions.lisp
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
(in-package #:serapeum)

(defmacro ignoring (type &body body)
"An improved version of `ignore-errors`.
The behavior is the same: if an error occurs in the body, the form
returns two values, `nil` and the condition itself.
`ignoring` forces you to specify the kind of error you want to ignore:
(ignoring parse-error
...)
I call it an improvement because I think `ignore-errors` is too broad:
by hiding all errors it becomes itself a source of bugs.
Of course you can still ignore all errors, at the cost of one extra
character:
(ignoring error
...)
NB `(ignoring t)` is a bad idea."
`(handler-case
(progn ,@body)
(,type (c)
(values nil c))))
"DEPRECATED: use `alexandria:ignore-some-conditions` instead."
(simple-style-warning "~s is deprecated, use ~s instead"
'ignoring 'ignore-some-conditions)
`(ignore-some-conditions (,type)
,@body))

(defun maybe-invoke-restart (restart &rest values)
"When RESTART is active, invoke it with VALUES."
Expand Down

0 comments on commit 3bc682d

Please sign in to comment.