Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Clojure and ClojureScript allow the user to handle platform exceptions with the 'try special form. This page aims to provide a specification for a cross-platform error handling strategy.

UPDATE 2013/11/05

ClojureScript regained its capability to catch all with ticket

The implemented syntax was

Code Block
(try .. 
  (catch :default e ..))

There is a pending ticket implementing this syntax for Clojure:


Error handling is highly platform dependent, '(try (catch)) directly dispatches on platform type names. There is no platform-independent catch-all clause.

'try special form has a cascaded 'instanceof dispatch built in, which is reasonable for java because it maps directly to the native try{}catch(E e){}, but adds complexity in ClojureScript, where the native try{}catch(e){} is untyped.

Currently there is no catch-all in clojurescript at all. [CLJS-661]


This proposal considers a generic design for '(try (catch)) expressions, that can be augmented with platform-dependent error handling.