Manage errors in import process.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
Refactor.
Remove useless method.
Update comments.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
Fix import.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>