-
Notifications
You must be signed in to change notification settings - Fork 111
updates extneded process queue with same error messages as normal pro… #684
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,17 +25,35 @@ process.on("message", (req) => { | |
let errorString | ||
if (err instanceof Error) { | ||
errorString = err.message || err.toString() | ||
if (errorString === "{}") { | ||
winston.debug("err.message or err.toString() for Error instance resulted in '{}'. Using a more descriptive fallback.") | ||
errorString = "Unnamed Error" | ||
Comment on lines
+28
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
} else if (typeof err === "object" && err !== null) { | ||
try { | ||
errorString = JSON.stringify(err) | ||
if (Object.prototype.hasOwnProperty.call(err, "message") && typeof (err).message === "string") { | ||
errorString = (err).message | ||
} else { | ||
const stringified = JSON.stringify(err) | ||
if (stringified === "{}" || stringified === "[]") { | ||
winston.debug("Error stringified into {}") | ||
errorString = err.toString() | ||
} else { | ||
errorString = stringified | ||
} | ||
} | ||
} catch (jsonError: any) { | ||
errorString = `[Object could not be stringified: ${jsonError.message || jsonError.toString()}]` | ||
} | ||
} else { | ||
errorString = String(err) | ||
if (errorString === "{}") { | ||
winston.debug("String(err) resulted in '{}'. Using a generic representation for non-object error.") | ||
errorString = "Unnamed Error" | ||
} | ||
} | ||
Comment on lines
26
to
54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error serialization logic is duplicated between // In src/hub/utils.ts
export function serializeError(err: any): string {
let errorString: string;
if (err instanceof Error) {
errorString = err.message || err.toString();
if (errorString === "{}") {
errorString = "Unnamed Error";
}
} else if (typeof err === "object" && err !== null) {
try {
if (Object.prototype.hasOwnProperty.call(err, "message") && typeof (err).message === "string") {
errorString = (err).message;
} else {
const stringified = JSON.stringify(err);
if (stringified === "{}" || stringified === "[]") {
errorString = err.toString();
} else {
errorString = stringified;
}
}
} catch (jsonError: any) {
errorString = `[Object could not be stringified: ${jsonError.message || jsonError.toString()}]`;
}
} else {
errorString = String(err);
if (errorString === "{}") {
errorString = "Unnamed Error";
}
}
return errorString;
}
// In extended_execute_process.ts and execute_process.ts
import { serializeError } from "../hub/utils";
.catch((err) => {
const errorString = serializeError(err);
winston.error(`Received Error on child...: ${errorString}. WebhookID: ${request.webhookId}`);
process.send!({ success: false, message: errorString });
}) |
||
const request = Hub.ActionRequest.fromIPC(req) | ||
winston.error(`Error on child: ${errorString}. WebhookID: ${request.webhookId}`) | ||
winston.error(`Received Error on child in extended queue: ${errorString}. WebhookID: ${request.webhookId}`) | ||
process.send!({success: false, message: errorString}) | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a more descriptive fallback error message instead of 'Unnamed Error'. This can aid in debugging when the error object doesn't provide a clear message.