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

TAN-1794 - FormSync / XLSX - return async errors #7837

Merged
merged 15 commits into from
May 16, 2024

Conversation

jamesspeake
Copy link
Contributor

@jamesspeake jamesspeake commented May 7, 2024

Errors now look like this - I've tweaked text to make it clearer. Second image shows errors we don't specifically catch - but don't expect these to happen often.
image

image

Could not get it to only throw errors for those ideas that have failed - this would be too big a refactor right now.

Changelog

Changed

  • XLSX/PDF import now return the errors being thrown within the Async job to give a clearer picture when something goes wrong

Copy link

@jamesspeake jamesspeake added this to the Formsync milestone May 7, 2024
@@ -3,13 +3,14 @@
module BulkImportIdeas
class IdeaImportJob < ApplicationJob
self.priority = 60
perform_retries false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't think we should be retrying these jobs - if they fail once they're likely to fail again

@cl-dev-bot
Copy link
Collaborator

cl-dev-bot commented May 7, 2024

Warnings
⚠️ The PR title contains no Jira issue key (case-sensitive)
⚠️ The branch name contains no Jira issue key (case-sensitive)
Messages
📖 Changelog provided 🎉
📖

Run the e2e tests

📖 Check translation progress

Generated by 🚫 dangerJS against 199c924

Copy link
Contributor

@alexander-cit alexander-cit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I would prefer if last_error_message returned a nice and clean string that can be immediately used by FE.

Because these .split(': '), split('#'), and startsWith('bulk_import_') seem very BE and Ruby specific. It could be properly formatted in the serializer. We could also more easily reuse this logic in back/engines/commercial/admin_api/app/controllers/admin_api/jobs_controller.rb if needed.

But it's not a blocker, up to you.

@jamesspeake
Copy link
Contributor Author

jamesspeake commented May 8, 2024

Maybe I would prefer if last_error_message returned a nice and clean string that can be immediately used by FE.

I've just updated this logic to the backend. There is now a method in the controller to return a generic 'uncaught_error' if it's not a recognised error string. Do you want to take a quick look @alexander-cit ?


// When a bulk import error - there will be additional params
const splitErrorParams = splitError[1].split('#');
const error_string = job.attributes.last_error_message;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be camel-cased as other variables?

const errorString = job.attributes.last_error_message;

Comment on lines 40 to 42
const splitErrorParams = error_string.split('#');
if (splitErrorParams.length > 1) {
const params = JSON.parse(splitErrorParams[1]) as JobErrorParams;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe these split and parse could also be done on the BE. The fact that we send to the FE JSON (HTTP response) with another JSON inside (these error params) seems a bit too complicated.

But it's definitely not a requirement. Feel free to merge!

jamesspeake and others added 5 commits May 13, 2024 12:48
# Conflicts:
#	front/app/translations/admin/ar-SA.json
#	front/app/translations/admin/da-DK.json
#	front/app/translations/admin/de-DE.json
#	front/app/translations/admin/en-CA.json
#	front/app/translations/admin/en-GB.json
#	front/app/translations/admin/en-IE.json
#	front/app/translations/admin/es-CL.json
#	front/app/translations/admin/es-ES.json
#	front/app/translations/admin/fi-FI.json
#	front/app/translations/admin/fr-BE.json
#	front/app/translations/admin/fr-FR.json
#	front/app/translations/admin/hr-HR.json
#	front/app/translations/admin/lv-LV.json
#	front/app/translations/admin/nb-NO.json
#	front/app/translations/admin/nl-BE.json
#	front/app/translations/admin/nl-NL.json
#	front/app/translations/admin/pl-PL.json
#	front/app/translations/admin/pt-BR.json
#	front/app/translations/admin/sr-Latn.json
#	front/app/translations/admin/sr-SP.json
#	front/app/translations/admin/sv-SE.json
#	front/app/translations/admin/tr-TR.json
@jamesspeake jamesspeake merged commit b8c18dc into master May 16, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants