node/test/message/throw_error_with_getter_throw.js
Anna Henningsen f72254037e
src: handle errors while printing error objects
Handle situations where accessing `.name` or `.stack` on an object
fails.

Fixes: https://github.com/nodejs/node/issues/25718

PR-URL: https://github.com/nodejs/node/pull/25834
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-03 20:37:52 +01:00

11 lines
215 B
JavaScript

'use strict';
require('../common');
throw { // eslint-disable-line no-throw-literal
get stack() {
throw new Error('weird throw but ok');
},
get name() {
throw new Error('weird throw but ok');
},
};