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

Better logging when failing to communicate with the server #111

Closed
giordano opened this issue Jun 17, 2022 · 0 comments · Fixed by #112
Closed

Better logging when failing to communicate with the server #111

giordano opened this issue Jun 17, 2022 · 0 comments · Fixed by #112
Labels
enhancement high priority logging Issues or pull request related to the logging infrastructure remote Communication with the Oracc server

Comments

@giordano
Copy link
Collaborator

In

async serverComplete(): Promise<void> {
let attempts = 0;
const max_attempts = 10;
while (attempts < max_attempts) {
attempts += 1;
const response = await fetch(`${this.url}/p/${this.responseID}`);
const text = await response.text();
switch (text.trim()) { // Message includes a trailing new line character
case 'done': // done processing
log('debug', `Result ready after ${attempts} attempts.`)
return;
case 'err_stat':
log('error', `Received err_stat for request ${this.responseID}.`);
throw `The server encountered an error while working on the request.
Please contact the Oracc server admin to look into this problem.`;
case 'run':
if (attempts < max_attempts) {
if (attempts == 1) { // Only print once to avoid cluttering log
log('debug', 'Server working on request.');
}
break;
} else {
throw `The Oracc server was unable to elaborate response
for request with id ${this.responseID}. Please contact the
Oracc server admin to look into this problem.`;
}
default:
log('error', `Unexpected message from server: ${text.trim()}`);
throw `Unexpected message from server: ${text.trim()}`;
}
}
}
we appear to log to file more debug information when the operation is successful rather than we fail. Some information should actually be displayed in the popup window, but not written to file.

This came up in #110.

@giordano giordano added remote Communication with the Oracc server high priority enhancement logging Issues or pull request related to the logging infrastructure labels Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement high priority logging Issues or pull request related to the logging infrastructure remote Communication with the Oracc server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant