aboutsummaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorJosh Bialkowski <josh.bialkowski@gmail.com>2019-12-13 13:17:26 -0800
committerMichael Muré <batolettre@gmail.com>2020-01-04 13:04:15 +0100
commitf15206e7b1d60239f4e42c618297554bda524b5e (patch)
treedcd11ebfe7861e1de3b2ed82295303afddbcc213 /bridge
parentca1d305308d4ee6d0fec16a0af10b62bb52cd265 (diff)
downloadgit-bug-f15206e7b1d60239f4e42c618297554bda524b5e.tar.gz
* Fix git config reader can't read values with spaces
* Add NewImportWarning for things that aren't exactly errors. Use this for unhandled changelog events. * Add NewExportWarning for things that aren't exactly errors. Use this for un-exportable status changes.
Diffstat (limited to 'bridge')
-rw-r--r--bridge/core/export.go17
-rw-r--r--bridge/core/import.go18
2 files changed, 35 insertions, 0 deletions
diff --git a/bridge/core/export.go b/bridge/core/export.go
index 0f45404c..4397a527 100644
--- a/bridge/core/export.go
+++ b/bridge/core/export.go
@@ -29,6 +29,10 @@ const (
// Error happened during export
ExportEventError
+
+ // Something wrong happened during export that is worth notifying to the user
+ // but not severe enough to consider the export a failure.
+ ExportEventWarning
)
// ExportResult is an event that is emitted during the export process, to
@@ -65,6 +69,11 @@ func (er ExportResult) String() string {
return fmt.Sprintf("export error at %s: %s", er.ID, er.Err.Error())
}
return fmt.Sprintf("export error: %s", er.Err.Error())
+ case ExportEventWarning:
+ if er.ID != "" {
+ return fmt.Sprintf("warning at %s: %s", er.ID, er.Err.Error())
+ }
+ return fmt.Sprintf("warning: %s", er.Err.Error())
default:
panic("unknown export result")
@@ -79,6 +88,14 @@ func NewExportError(err error, id entity.Id) ExportResult {
}
}
+func NewExportWarning(err error, id entity.Id) ExportResult {
+ return ExportResult{
+ ID: id,
+ Err: err,
+ Event: ExportEventWarning,
+ }
+}
+
func NewExportNothing(id entity.Id, reason string) ExportResult {
return ExportResult{
ID: id,
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,