Back

ex-str (clj)

(source)

function

(ex-str {:clojure.error/keys [phase source path line column symbol class cause spec], :as triage-data})
Returns a string from exception data, as produced by ex-triage. The first line summarizes the exception phase and location. The subsequent lines describe the cause.

Examples

clojure

(ns clojure.test-clojure.main
  (:use clojure.test
        [clojure.test-helper :only [platform-newlines]])
  (:require [clojure.main :as main]))

(deftest null-stack-error-reporting
  (let [e (doto (Error. "xyz")
            (.setStackTrace (into-array java.lang.StackTraceElement nil)))
        tr-data (-> e Throwable->map main/ex-triage)]
    (is (= tr-data #:clojure.error{:phase :execution, :class 'java.lang.Error, :cause "xyz"}))
    (is (= (main/ex-str tr-data) (platform-newlines "Execution error (Error) at (REPL:1).\nxyz\n")))))