src: handle errors while printing error objects · nodejs/node@84358b5 · GitHub
Skip to content

Commit 84358b5

Browse files
committed
src: handle errors while printing error objects
Handle situations where accessing `.name` or `.stack` on an object fails. Fixes: #25718 PR-URL: #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>
1 parent f027290 commit 84358b5

3 files changed

Lines changed: 33 additions & 17 deletions

File tree

src/node_errors.cc

Lines changed: 18 additions & 17 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
require('../common');
3+
throw { // eslint-disable-line no-throw-literal
4+
get stack() {
5+
throw new Error('weird throw but ok');
6+
},
7+
get name() {
8+
throw new Error('weird throw but ok');
9+
},
10+
};
Lines changed: 5 additions & 0 deletions

0 commit comments

Comments
 (0)