Back

print-throwable (clj)

(source)

function

(print-throwable tr)
Prints the class and message of a Throwable. Prints the ex-data map if present.

Examples

clojure/core.typed
(deftest e-test
  (is-tc-e #(e) [-> Any]
           :requires [[clojure.stacktrace :refer [e]]]))

(deftest print-throwable-test
  (is-tc-e #(print-throwable (Exception. "a")) [-> Any]
           :requires [[clojure.stacktrace :refer [print-throwable]]])
  (is-tc-err #(print-throwable "A")  [-> Any]
             :requires [[clojure.stacktrace :refer [print-throwable]]]))
typedclojure/typedclojure
(deftest e-test
  (is-tc-e #(e) [-> t/Any]
           :requires [[clojure.stacktrace :refer [e]]]))

(deftest print-throwable-test
  (is-tc-e #(print-throwable (Exception. "a")) [-> t/Any]
           :requires [[clojure.stacktrace :refer [print-throwable]]])
  (is-tc-err #(print-throwable "A")  [-> t/Any]
             :requires [[clojure.stacktrace :refer [print-throwable]]]))
epiccastle/spire
(ns spire.namespaces
  (:require [spire.ssh :as ssh]
            [spire.utils :as utils]
            [spire.context :as context]
            [spire.transport :as transport]
            [spire.state :as state]
            [spire.output.core]
            [spire.output.default]
            [spire.output.events]
            [spire.output.quiet]
            [spire.facts :as facts]
            [spire.selmer :as selmer]
            [spire.module.curl :as curl]
            [spire.module.line-in-file :as line-in-file]
            [spire.module.get-file :as get-file]
            [spire.module.download :as download]
            [spire.module.upload :as upload]
            [spire.module.user :as user]
            [spire.module.apt :as apt]
            [spire.module.aws :as aws]
            [spire.module.attrs :as attrs]
            [spire.module.apt-repo :as apt-repo]
            [spire.module.apt-key :as apt-key]
            [spire.module.pkg :as pkg]
            [spire.module.rm :as rm]
            [spire.module.group :as group]
            [spire.module.mkdir :as mkdir]
            [spire.module.shell :as shell]
            [spire.module.sysctl :as sysctl]
            [spire.module.service :as service]
            [spire.module.authorized-keys :as authorized-keys]
            [spire.module.stat :as stat]
            [spire.module.sudo :as sudo]
            [spire.local]
            [spire.remote]
            [spire.default]
            [clojure.tools.cli]
            [clojure.java.shell]
            [clojure.edn]
            [clojure.stacktrace :as stacktrace]
            [clojure.string]
            [clojure.set]
            [clojure.java.io]
            [clojure.data.json]
            [sci.core :as sci]
            [clj-http.lite.core]
            [clj-http.lite.client]
            [clj-http.lite.links]
            [clj-http.lite.util]
            [cheshire.core]
            [cheshire.custom]
            [cheshire.exact]
            [cheshire.experimental]
            [cheshire.factory]
            [cheshire.generate]
            [cheshire.generate-seq]
            [cheshire.parse]
            [fipp.edn]
            [edamame.core]
            [spire.sci :refer [make-sci-bindings
                               make-sci-bindings-clean
                               sci-bind-macro
                               clojure-repl]]
            [sci.impl.namespaces :refer [copy-var]]
            [sci.impl.vars :as vars]))

(def namespaces
  {
   'clojure.core {'slurp slurp
                  'spit spit
                  'future (with-meta @#'clojure.core/future {:sci/macro true})
                  'future-call clojure.core/future-call
                  '*in* (sci/new-dynamic-var '*in* *in*)
                  '*out* (sci/new-dynamic-var '*out* *out*)
                  '*err* (sci/new-dynamic-var '*err* *err*)
                  }
   'clojure.main {'repl-requires
                  '[[clojure.repl :refer [dir doc]]
                    [clojure.pprint :refer [pprint]]
                    [spire.default :refer [push-ssh! set-ssh!
                                           push-local! set-local!
                                           pop! empty!]]]}
   'clojure.pprint (make-sci-bindings fipp.edn)
   'clojure.repl clojure-repl
   'clojure.stacktrace {'root-cause stacktrace/root-cause
                        'print-trace-element (redirect-out-to-sci stacktrace/print-trace-element)
                        'print-throwable (redirect-out-to-sci stacktrace/print-throwable)
                        'print-stack-trace (redirect-out-to-sci stacktrace/print-stack-trace)
                        'print-cause-trace (redirect-out-to-sci stacktrace/print-cause-trace)}