clj-commons / clj-commons/failjure

Document the using with with-open

Open
#7 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
427
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Hello!

First of all, thanks for failjure

I would be glad if you write an example how to use failjure for cases, where a user needs to close opened resources in any case. E.g. I’m doing the next:

(f/attempt-all [reader (pdf-reader source)
document (pdf-document reader)
fields (fields document)]
(do
(.close document)
(.close reader)
fields)
(f/when-fail [e]
; Here I do not have an access to reader and document
; to close them
))

I wonder if there any mechanism to close the `document` and the `reader` in any case, like with `with-open`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing failjure documentation and the usage of `attempt-all` and `when-fail`. Add an example showing how resource cleanup can be handled with `with-open`, including the failure case, and make the documented behavior clear for readers working with opened resources.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.