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: avoid non-stringify error #289

Merged
merged 1 commit into from
Jan 21, 2025
Merged
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: 5 additions & 1 deletion src/lifecycle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert';
import { EventEmitter } from 'node:events';
import { debuglog } from 'node:util';
import { debuglog, format } from 'node:util';
import { isClass } from 'is-type-of';
import { Ready as ReadyObject } from 'get-ready';
import type { ReadyFunctionArg } from 'get-ready';
Expand Down Expand Up @@ -387,6 +387,10 @@
done();
this.timing.end(timingKey);
}, (err: Error) => {
// avoid non-stringify error: TypeError: Cannot convert object to primitive value
if (!(err instanceof Error)) {
err = new Error(format('%s', err));
}

Check warning on line 393 in src/lifecycle.ts

View check run for this annotation

Codecov / codecov/patch

src/lifecycle.ts#L392-L393

Added lines #L392 - L393 were not covered by tests
done(err);
this.timing.end(timingKey);
});
Expand Down
Loading