Clojure

Data Conveying Exception

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: 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
  1. 0733-data-conveying-exception.patch
    28/Jan/11 2:14 PM
    4 kB
    Stuart Halloway
  2. 0733-data-conveying-exception-2.patch
    28/Jan/11 2:47 PM
    4 kB
    Alan Dipert
  3. 0733-dec-2-edition.patch
    02/Dec/11 10:07 AM
    4 kB
    Stuart Halloway
  4. 0733-ExceptionInfo.patch
    14/Oct/11 12:52 PM
    4 kB
    Stuart Halloway
  5. 0733-with-ex-data-and-ex-info.patch
    16/Oct/11 6:06 AM
    4 kB
    Stuart Halloway
  6. 0733-with-map-check.patch
    21/Oct/11 10:21 AM
    4 kB
    Alan Dipert

Activity

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: