Handle custom exception types in proxy

Fixes #610 (Plugins play havoc with custom exception types)