aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/core/import.go
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/core/import.go')
-rw-r--r--bridge/core/import.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/bridge/core/import.go b/bridge/core/import.go
index e4771d2c..5f138da7 100644
--- a/bridge/core/import.go
+++ b/bridge/core/import.go
@@ -31,6 +31,10 @@ const (
// Error happened during import
ImportEventError
+
+ // Something wrong happened during import that is worth notifying to the user
+ // but not severe enough to consider the import a failure.
+ ImportEventWarning
)
// ImportResult is an event that is emitted during the import process, to
@@ -69,6 +73,12 @@ func (er ImportResult) String() string {
return fmt.Sprintf("import error at id %s: %s", er.ID, er.Err.Error())
}
return fmt.Sprintf("import error: %s", er.Err.Error())
+ case ImportEventWarning:
+ if er.ID != "" {
+ return fmt.Sprintf("warning at id %s: %s", er.ID, er.Err.Error())
+ }
+ return fmt.Sprintf("warning: %s", er.Err.Error())
+
default:
panic("unknown import result")
}
@@ -82,6 +92,14 @@ func NewImportError(err error, id entity.Id) ImportResult {
}
}
+func NewImportWarning(err error, id entity.Id) ImportResult {
+ return ImportResult{
+ Err: err,
+ ID: id,
+ Event: ImportEventWarning,
+ }
+}
+
func NewImportNothing(id entity.Id, reason string) ImportResult {
return ImportResult{
ID: id,