active_importer icon indicating copy to clipboard operation
active_importer copied to clipboard

Returning a summary message

Open weavermedia opened this issue 11 years ago • 2 comments

During the import process I'm using the row_* callbacks to build a summary message for the user, something like:

156 row(s) processed.
154 row(s) successfully imported.
Error on row 25 - Validation failed: Email address has already been taken.
Error on row 89 - Validation failed: Email address has already been taken.

Is there any method implemented for passing this back to the caller of the importer class?

I tried result = UserImporter.import('/path/to/file.xls') to see what I got back but it was just a Range.

weavermedia avatar May 14 '14 00:05 weavermedia

I'll look into it.

gnapse avatar May 14 '14 15:05 gnapse

This references #18.

What I'd really like is some consistency with what is returned.

Depending on how the import process goes, by default, the result of the .import call can be:

  • it returns a range (if the whole process is a success)
  • it returns an exception (if there is something like a UTF-8 read-error)
  • it throws an app-wide fatal exception (if the column headers are incorrect)

It might be good to get something useful and consistent returned back from the method call.

weavermedia avatar May 24 '14 18:05 weavermedia