Improve compiler error display for latest Chromium

This commit addresses the issue of Chromium v126 and later not displaying
error messages correctly when the error object's `message` property uses
a getter. It refactors the code to utilize an immutable Error object with
recursive context, improves error message formatting and leverages the
`cause` property.

Changes:

- Refactor error wrapping internals to use an immutable error object,
  eliminating `message` getters.
- Utilize the `cause` property in contextual errors for enhanced error
  display in the console.
- Enhance message formatting with better indentation and listing.
- Improve clarity by renaming values thrown during validations.
This commit is contained in:
undergroundwires
2024-07-21 10:18:27 +02:00
parent abe03cef3f
commit b16e13678c
15 changed files with 253 additions and 110 deletions

View File

@@ -57,7 +57,7 @@ describe('FunctionCallsParser', () => {
const data = new FunctionCallDataStub();
const expectedAssertion: ObjectAssertion<FunctionCallData> = {
value: data,
valueName: 'function call',
valueName: 'Function call',
allowedProperties: [
'function', 'parameters',
],
@@ -117,7 +117,7 @@ describe('FunctionCallsParser', () => {
const data: FunctionCallsData = [new FunctionCallDataStub()];
const expectedAssertion: NonEmptyCollectionAssertion = {
value: data,
valueName: 'function call sequence',
valueName: 'Function call sequence',
};
const validator = new TypeValidatorStub();
const context = new TestContext()
@@ -134,7 +134,7 @@ describe('FunctionCallsParser', () => {
const data: FunctionCallsData = [expectedValidatedCallData];
const expectedAssertion: ObjectAssertion<FunctionCallData> = {
value: expectedValidatedCallData,
valueName: 'function call',
valueName: 'Function call',
allowedProperties: [
'function', 'parameters',
],