unhandled exception info in 0.1.2 and in master

11 views
Skip to first unread message

Stepan Koltsov

unread,
Aug 4, 2012, 6:35:52 PM8/4/12
to clay-l...@googlegroups.com
Hi.

Clay 0.1.2 and master print unhandled exceptions differently.

Program:

```
record MyException(x: Int);

instance Exception (MyException);

main() {
    throw MyException(12);
}
```

Clay 0.1.2 prints:

```
unhandled exception: MyException(12)
```

Clay from master prints:

```
unhandled MyException exception
```

Clay 0.1.2 output is better, because exception may contain useful data.

Change was in in this commit: https://github.com/jckarter/clay/commit/899df68408641152d967f5ca159ee6ae257d6a9e

Commit message tells that change was done to drop printer dependency. What's wrong in calling printer in unhandled exception handler?

--
Stepan Koltsov

Joe Groff

unread,
Aug 5, 2012, 2:13:29 PM8/5/12
to clay-l...@googlegroups.com
One of the goals of 0.2 is to separate out a small core library with
minimal runtime overhead. The printer module has a non-negligible
runtime and compile-time overhead so was made optional. The current
output is a stopgap. Ideally there would be an errorMessage generic
for exception types to overload (similar to std::exception::what in
C++), and core exception handlers would use that generic to deliver a
better error message. The printer module could provide a default
implementation that gives the 0.1 output when it is in use.

-Joe
Reply all
Reply to author
Forward
0 new messages