Skip to content
This repository was archived by the owner on Nov 23, 2021. It is now read-only.
This repository was archived by the owner on Nov 23, 2021. It is now read-only.

Headers errors kill the process #18

@weavermedia

Description

@weavermedia

Attempting to import a spreadsheet with incorrect headers is detected in the gem's load_header method but it does a raise error which stops the import process dead unless I wrap the import call in a rescue block with:

begin
  UserImporter.import(file.path, extension: :csv)
rescue => e
  puts e.message
end

This makes every call to import quite verbose and unnecessary when there is already an elegant :import_failed handler.

Maybe it would be better to fire the :import_failed event when load_header fails? This would allow me to handle the error in the same way as I handle other errors like row validations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions