Reputation: 5020
How can I see the arguments passed to the functions in a Clojure stacktrace?
For example, how could I see what arguments were passed to *get-item
, *normalize-item-ref
, outvalue-of
, happiness
, and nodestr
in this stacktrace? It would be nice to see how the program got to the error rather than just the error.
ERROR in (this-test) (workspace.clj:330)
Uncaught exception, not in assertion.
expected: nil
actual: java.lang.AssertionError: Assert failed: (item-or-item-ref? item-or-item-ref)
at fargish.workspace$_STAR_get_item.invokeStatic (workspace.clj:330)
fargish.workspace$_STAR_get_item.invoke (workspace.clj:330)
fargish.workspace$_STAR_normalize_item_ref.invokeStatic (workspace.clj:365)
fargish.workspace$_STAR_normalize_item_ref.invoke (workspace.clj:360)
fargish.workspace$outvalue_of.invokeStatic (workspace.clj:815)
fargish.workspace$outvalue_of.invoke (workspace.clj:810)
fargish.workspace$outvalue_of.invokeStatic (workspace.clj:812)
fargish.workspace$outvalue_of.invoke (workspace.clj:810)
fargish.workspace$happiness.invokeStatic (workspace.clj:904)
fargish.workspace$happiness.invoke (workspace.clj:902)
fargish.workspace$nodestr.invokeStatic (workspace.clj:1039)
fargish.workspace$nodestr.invoke (workspace.clj:1035)
. . .
Upvotes: 1
Views: 217
Reputation: 91
You can run sayid (http://bpiel.github.io/sayid/) on the namespace you are interested in. It will keep track of all function calls and arguments.
I think this is mostly useful for development/debugging. For production, the try-catch recommendation by amalloy above is probably best.
Upvotes: 2