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

importFiles errors #25

Open
runegan opened this issue May 18, 2017 · 1 comment
Open

importFiles errors #25

runegan opened this issue May 18, 2017 · 1 comment
Labels
enhancement New feature or request major

Comments

@runegan
Copy link
Member

runegan commented May 18, 2017

Original report by Rune Gangsø (Bitbucket: runegan, GitHub: runegan).


Currently if an error is thrown when importing multiple files with aeq.project.importFiles the import is stopped and no items, some of which could have been imported successfully, is not returned. I think it would be better to gather the errors, and let all items be imported.

The problem then becomes: what to do with the errors?

My ideal solution would be something where the items that was imported still gets returned, as I probably want to do something with them, but I still get to control what to do with the errors.

Some solutions:

  • Return an object { items, errors }
  • Store add an errors attribute to the return array
  • Add the error into the array instead of the item that should be there.
    • Good: If the files where in a particular order or are specific to the script, the script get to know which particular files was not imported.
    • Bad: You have to do if ( item instanceof Error ) for all items the array before doing what you intend.
@runegan
Copy link
Member Author

runegan commented May 24, 2017

Original comment by Zack Lovatt (Bitbucket: zlovatt, GitHub: zlovatt).


I like the Store add an errors attribute to the return array option. This way you still get a standard array of the items, but also have the ability to check errors if you want. Can add in metadata such as errored filename and the file.error info

@runegan runegan added major enhancement New feature or request labels Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request major
Projects
None yet
Development

No branches or pull requests

1 participant