Allocate new object for exception, since stack property

is (evidently) read only on some platforms.

Fixes #1611