Domain errors now include the correct trace

Closes #707