Open
Description
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.