https://github.com/ivarref/defnlogged
A moderately opinionated defn macro for building more reliable systems
https://github.com/ivarref/defnlogged
clojure
Last synced: 3 months ago
JSON representation
A moderately opinionated defn macro for building more reliable systems
- Host: GitHub
- URL: https://github.com/ivarref/defnlogged
- Owner: ivarref
- License: epl-2.0
- Created: 2023-06-06T07:20:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-16T18:44:51.000Z (over 2 years ago)
- Last Synced: 2025-03-11T23:37:17.670Z (10 months ago)
- Topics: clojure
- Language: Clojure
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# defnlogged
`defnl` is an opinionated `defn` macro for building more robust systems.
It supports declarative timeout and exception handling, as well as
default return values.
## Installation
```clojure
com.github.ivarref/defnlogged {:git/tag "0.0.1" :git/sha "..."}
```
Add
```
{:lint-as {com.github.ivarref.defnlogged/defnl clojure.core/defn}}
```
to your `.clj-kondo/config.edn`.
## Usage
```clojure
; Add
(:require
[com.github.ivarref.defnlogged :refer [defnl]])
; to your ns declaration
(defnl brittle-fn
{:timeout-ms 600000 ; or (java.time.Duration/ofMinutes 10)
:default-val nil} ; return nil on failures/timeouts
[]
(some-legacy-lib/unstable-network-io))
```