chickadee » srfi-189 » exception->either

exception->either pred thunkprocedure

This procedure is in a sense the inverse of maybe-ref. A call to thunk is made, wrapped in an exception handler that examines any exception signaled during thunk's execution. If the condition object satisfies pred, it is wrapped in a Left which is then returned; if it does not, the exception is reraised. But if no exception is raised, the values returned by thunk are wrapped in a Right and the Right is returned.