File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change 370
370
make-throwable throwable?
371
371
[^{:doc " Throwable object" } value throwable-value ])
372
372
373
+ (defn ^:no-doc build-condition [base who message ?irritants]
374
+ (let [g (group-by (fn [thing]
375
+ (or (condition? thing)
376
+ #?(:cljs (instance? js/Error thing)
377
+ :clj (instance? Throwable thing))))
378
+ ?irritants)
379
+ irritants (get g false )
380
+ conditions (get g true )]
381
+ (apply combine-conditions
382
+ base
383
+ (and who (make-who-condition who))
384
+ (make-message-condition message)
385
+ (and (not-empty irritants) (make-irritants-condition irritants))
386
+ conditions)))
387
+
373
388
#?(:clj
374
389
(defmacro throw-condition
375
390
" Throw a condition.
376
391
377
392
For internal use."
378
393
[?base ?who ?message ?irritants]
379
- `(let [g# (group-by (fn [thing#] (or (condition? thing#) (if-cljs (instance? js/Error thing#) (instance? Throwable thing#)))) ~?irritants)
380
- irritants# (get g# false )
381
- conditions# (get g# true )
382
- who# ~?who]
383
- (throw (apply combine-conditions
384
- ~?base
385
- (and who# (make-who-condition who#))
386
- (make-message-condition ~?message)
387
- (and (not-empty irritants#) (make-irritants-condition irritants#))
388
- conditions#)))))
394
+ `(throw (build-condition ~?base ~?who ~?message ~?irritants))))
389
395
390
396
(defn error
391
397
" Throw an exception that signals that an error has occurred.
You can’t perform that action at this time.
0 commit comments