-
-
Notifications
You must be signed in to change notification settings - Fork 13
Handle missing executor in NodeJS #528
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: main
Are you sure you want to change the base?
Changes from 6 commits
c82fe0a
c702757
3dc28a5
bda88c6
ae3797a
4aee413
218d52a
9cf3a0e
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 |
|---|---|---|
|
|
@@ -111,7 +111,11 @@ | |
| "warning": { | ||
| "description": "Present when data has a problem", | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "hash_id": { | ||
| "description": "Has value of the JSON string omtting label value", | ||
|
sven-oly marked this conversation as resolved.
|
||
| "type": "integer" | ||
| } | ||
|
Comment on lines
+115
to
+118
Member
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. Question: I don't see |
||
| }, | ||
| "required": [ | ||
| "label", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -512,9 +512,11 @@ def send_one_line(self, input_line): | |
| logging.error(' !!!!!! %s' % self.run_error_message) | ||
|
|
||
| # Handle problems with decoding errors and other unknowns. | ||
| error_result = {'label': 'UNKNOWN', | ||
| error_result = {'label': input['label'], | ||
| 'input_data': input_line, | ||
| 'error': self.run_error_message | ||
| 'error': self.run_error_message, | ||
| 'error_detail': 'severe error from subprocess ' + | ||
| result.returncode, | ||
| } | ||
|
Comment on lines
+518
to
523
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. This block introduces two critical issues that will cause a crash:
I've provided a suggestion that resolves both issues by safely parsing the input to retrieve the label and correctly handling the type conversion. label = 'UNKNOWN'
try:
input_json = json.loads(input_line.splitlines()[0])
label = input_json.get('label', 'UNKNOWN')
except (IndexError, json.JSONDecodeError):
pass # Fallback to 'UNKNOWN' if parsing fails
error_result = {'label': label,
'input_data': input_line,
'error': self.run_error_message,
'error_detail': 'severe error from subprocess ' +
str(result.returncode),
}
Member
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. please fix |
||
| return json.dumps(error_result) | ||
| except BaseException as err: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.