CORE-4032: fixed a bug that prevented errors from being trapped properly