OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Why the Error constructor doesn't set message property for its heir instance in Node.js?

  • Thread starter Thread starter Minix Li
  • Start date Start date
M

Minix Li

Guest
Here is the code:

enter image description here

and the result:

enter image description here

When I write my own parent Error class and inherit it using same code, the message property is set as expected.

Here is the code:

enter image description here

and the result:

enter image description here

<p>Here is the code:</p>
<p><a href="https://i.sstatic.net/3eNjZslD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3eNjZslD.png" alt="enter image description here" /></a></p>
<p>and the result:</p>
<p><a href="https://i.sstatic.net/JJhLdC2C.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JJhLdC2C.png" alt="enter image description here" /></a></p>
<p>When I write my own parent Error class and inherit it using same code, the message property is set as expected.</p>
<p>Here is the code:</p>
<p><a href="https://i.sstatic.net/nuZjswuP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nuZjswuP.png" alt="enter image description here" /></a></p>
<p>and the result:</p>
<p><a href="https://i.sstatic.net/iOVdJOj8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iOVdJOj8.png" alt="enter image description here" /></a></p>
 

Latest posts

Top