From b4963635069fc71ad2185743a35885fa421ea697 Mon Sep 17 00:00:00 2001 From: "Paul M. Rodriguez" Date: Sun, 2 Jan 2022 15:30:19 -0600 Subject: [PATCH] Deprecate ignoring (per #62) --- conditions.lisp | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/conditions.lisp b/conditions.lisp index fe56b27e..07838afb 100644 --- a/conditions.lisp +++ b/conditions.lisp @@ -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."