Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(3.4.1): convert Error class to object in worker #519

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .freeCodeCamp/tooling/tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ export async function runTests(ws, projectDashedName) {
logover.error(`Test #${testId}:`, error);
}

if (error.text?.message) {
const assertionTranslation = await t(error.text.message, {});
error.text.message = assertionTranslation || error.text.message;
if (error.message) {
const assertionTranslation = await t(error.message, {});
error.message = assertionTranslation || error.message;
}

const consoleError = {
Expand Down
4 changes: 3 additions & 1 deletion .freeCodeCamp/tooling/tests/test-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ parentPort.on('message', async ({ testCode, testId }) => {
passed = true;
} catch (e) {
error = {};
error.text = e;
Object.getOwnPropertyNames(e).forEach(key => {
error[key] = e[key];
});
// Cannot pass `e` "as is", because classes cannot be passed between threads
error.type = e instanceof AssertionError ? 'AssertionError' : 'Error';
}
Expand Down
6 changes: 6 additions & 0 deletions docs/src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [3.4.1] - 2024-03-11

### Fix

- Convert `Error` class to object in worker before sending to parent

## [3.4.0] - 2024-03-05

### Add
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@freecodecamp/freecodecamp-os",
"author": "freeCodeCamp",
"version": "3.4.0",
"version": "3.4.1",
"description": "Package used for freeCodeCamp projects with the freeCodeCamp Courses VSCode extension",
"scripts": {
"build:client": "NODE_ENV=production webpack --config ./.freeCodeCamp/webpack.config.cjs",
Expand Down
Loading