- edited description
importFiles errors
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.
Comments (4)
-
reporter -
reporter - edited description
-
reporter - changed status to open
-
Account Deleted 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 checkerrors
if you want. Can add in metadata such as errored filename and thefile.error
info - Log in to comment