Details
-
Type:
Enhancement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: Approved Backlog
-
Component/s: None
-
Labels:None
-
Patch:Code and Test
-
Approval:Ok
Description
Problem: need to convey diagnostic information in an exception, and Java exceptions are poor for this because they don't have any place to put data. Having many apps write their own exceptions is unnecessary code bloat, and sometimes has compilation implications.
Choices made:
- Naming it ExceptionInfo. Needs to tell the user that it carries data, without suggesting that there was a problem with data.
- think we have to include Exception in the name, esp. for interop consumers.
- Class of data member. IPersistentMap
- Class of map input. IPersistentMap
- Do not want to build anything to support conditional logic. (Use bindings for this).
- Base class. RuntimeException is consistent with a dynamic language (don't want to impose checked exceptions).
- print with data just after msg on first line
- equality by identity (pretty much dictated by having exception as base class)
- ex-info factory function
- ex-data fn to get the data out
- data and msg arguments required
- data argument comes second
- matches Java expectation of msg first, cause last
- matches print order
ex-info and ex-data seem rather terse names to me (exception-info and exception-data would be clearer, imho). Clojure seems to have a mixture of abbreviated names and full names, but it was my vague impression that most of the abbreviations stemmed from traditional lisp or java usage.