I have a problem where the console will log an error twice when using \n in the error message.
Here is an example:
throw new Error("Vector lengths must be equal");
The code above results in :
Error: Vector lengths must be equal
As you can see this error message has printed once as expected.
throw new Error("Vector lengths must be equal" + "\nVector[0] = 1");
The code above results in :
Error: Vector lengths must be equal
Vector[0] = 1
Error: Vector lengths must be equal
Vector[0] = 1
Here, I have added \n in the error message to create a break in the error message for increased readability, but as you can see it prints the error message twice which is unexpected and repetitive.
Please advise me in any way on how I can work around or even fix this problem.