Add specs for marshalling exceptions

This was causing a problem with the Rails specs and also relates to
issue #1123
Fix marshalling Exception

Fixes #1123