-
Notifications
You must be signed in to change notification settings - Fork 902
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: dont interrupt response on display updation failure #2102
fix: dont interrupt response on display updation failure #2102
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
packages/lib/responseQueue.tsInstead of using console.log for error logging, it would be better to use a dedicated logging library that provides more flexibility and control over log levels, formats, and destinations. This will improve the readability and maintainability of your code. import { Logger } from 'some-logging-library';
const logger = new Logger();
// ...
try {
await this.api.client.display.update(this.surveyState.displayId, {
responseId: response.data.id,
});
} catch (error) {
logger.error("Failed to update display, proceeding with the response.", error);
}
It's a good practice to not expose the entire error object in the logs, especially in production, as it may contain sensitive information. Instead, log only the necessary details such as the error message. try {
await this.api.client.display.update(this.surveyState.displayId, {
responseId: response.data.id,
});
} catch (error) {
logger.error(`Failed to update display, proceeding with the response. Error: ${error.message}`);
}
|
packages/lib/responseQueue.ts
Outdated
await this.api.client.display.update(this.surveyState.displayId, { | ||
responseId: response.data.id, | ||
}); | ||
} catch (error) { | ||
console.log("Failed to update display, proceeding with the response.", error); | ||
} |
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.
The error object is being logged entirely which may expose sensitive information. The fix involves logging only the error message.
await this.api.client.display.update(this.surveyState.displayId, { | |
responseId: response.data.id, | |
}); | |
} catch (error) { | |
console.log("Failed to update display, proceeding with the response.", error); | |
} | |
```typescript | |
try { | |
await this.api.client.display.update(this.surveyState.displayId, { | |
responseId: response.data.id, | |
}); | |
} catch (error) { | |
console.log(`Failed to update display, proceeding with the response. Error: ${error.message}`); | |
} | |
``` |
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.
@ShubhamPalriwala thanks for the PR 😊💪
What does this PR do?
Currently the Response Creation on Surveys block if the Display Update API throws an error even if the Response API is working fine!
This PR fixes it by ignoring the display updation if it fails!
How should this be tested?
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated