Don't try to access `stack` of undefined exceptions.

Currently, throwing `undefined` will cause Jest to fatal: `TypeError: Cannot read property 'stack' of undefined`.