diff --git a/internal/app/app.go b/internal/app/app.go index f5b28a7..702d4c0 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -97,7 +97,7 @@ func (a *App) PurgeLogDirectory() { if err == nil { zenity.Info("Successfully purged log directory.", zenity.InfoIcon) } else { - zenity.Info(err.Error(), zenity.Title("Encountered an error while purging log directory."), zenity.WarningIcon) + zenity.Error(err.Error(), zenity.Title("Encountered an error while purging log directory."), zenity.WarningIcon) } } @@ -173,7 +173,7 @@ func (a *App) EnterText(title, info, defaultEntry string) string { if err == zenity.ErrCanceled { return "" } else if err != nil { - zenity.Info(err.Error(), zenity.Title("Encountered an error!"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Encountered an error!"), zenity.ErrorIcon) return "" } else { return input diff --git a/internal/app/app_settings.go b/internal/app/app_settings.go index c2f7f2b..b8fb123 100644 --- a/internal/app/app_settings.go +++ b/internal/app/app_settings.go @@ -47,7 +47,7 @@ func (a *App) Settings() Settings { if err != nil { runtime.LogWarning(a.ctx, "Cannot unmarshal settings.json:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info("Could not retrieve application settings, using defaults!", zenity.Title("Information"), zenity.WarningIcon) + zenity.Warning("Could not retrieve application settings, using defaults!", zenity.WarningIcon) } return s } @@ -59,7 +59,7 @@ func (a *App) UpdateSettings(jsonData string) Settings { if err != nil { runtime.LogError(a.ctx, "Malformed JSON for settings file:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Malformed JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Malformed JSON"), zenity.ErrorIcon) return s } @@ -67,7 +67,7 @@ func (a *App) UpdateSettings(jsonData string) Settings { if err != nil { runtime.LogError(a.ctx, "Could not marshal settings into JSON:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Malformed JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Malformed JSON"), zenity.ErrorIcon) return s } @@ -76,7 +76,7 @@ func (a *App) UpdateSettings(jsonData string) Settings { if err != nil { runtime.LogError(a.ctx, "Could not update host list:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not update host list"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not update host list"), zenity.ErrorIcon) } return s diff --git a/internal/app/collection.go b/internal/app/collection.go index 684e682..b0c97fe 100644 --- a/internal/app/collection.go +++ b/internal/app/collection.go @@ -19,7 +19,7 @@ func (a *App) OpenCollection(hostKey, dbKey, collKey string) (result bson.M) { if err != nil { runtime.LogWarning(a.ctx, "Could not retrieve collection stats for "+collKey) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not get stats"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not get stats"), zenity.ErrorIcon) return nil } @@ -42,7 +42,7 @@ func (a *App) RenameCollection(hostKey, dbKey, collKey, newCollKey string) bool if err != nil { runtime.LogWarning(a.ctx, "Could not rename collection "+collKey) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while renaming collection"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while renaming collection"), zenity.ErrorIcon) return false } @@ -65,7 +65,7 @@ func (a *App) TruncateCollection(hostKey, dbKey, collKey string) bool { if err != nil { runtime.LogWarning(a.ctx, "Could not truncate collection "+collKey) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while truncating collection"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while truncating collection"), zenity.ErrorIcon) return false } @@ -88,7 +88,7 @@ func (a *App) DropCollection(hostKey, dbKey, collKey string) bool { if err != nil { runtime.LogWarning(a.ctx, "Could not drop collection "+collKey) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while dropping collection"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while dropping collection"), zenity.ErrorIcon) return false } diff --git a/internal/app/collection_aggregate.go b/internal/app/collection_aggregate.go index f2d5ceb..74ef37f 100644 --- a/internal/app/collection_aggregate.go +++ b/internal/app/collection_aggregate.go @@ -16,7 +16,7 @@ func (a *App) Aggregate(hostKey, dbKey, collKey, pipelineJson, settingsJson stri if err := json.Unmarshal([]byte(settingsJson), &settings); err != nil { runtime.LogError(a.ctx, "Could not parse aggregation settings:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Couldn't parse aggregation settings"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Couldn't parse aggregation settings"), zenity.ErrorIcon) return } @@ -24,7 +24,7 @@ func (a *App) Aggregate(hostKey, dbKey, collKey, pipelineJson, settingsJson stri if err := bson.UnmarshalExtJSON([]byte(pipelineJson), true, &pipeline); err != nil { runtime.LogWarning(a.ctx, "Could not parse aggregation pipeline:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Couldn't parse aggregation pipeline"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Couldn't parse aggregation pipeline"), zenity.ErrorIcon) return } @@ -39,7 +39,7 @@ func (a *App) Aggregate(hostKey, dbKey, collKey, pipelineJson, settingsJson stri if err != nil { runtime.LogWarning(a.ctx, "Could not get aggregation cursor:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Couldn't get aggregation cursor"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Couldn't get aggregation cursor"), zenity.ErrorIcon) return } @@ -47,7 +47,7 @@ func (a *App) Aggregate(hostKey, dbKey, collKey, pipelineJson, settingsJson stri if err := cursor.All(ctx, &results); err != nil { runtime.LogInfo(a.ctx, "Error while running aggregation pipeline:") runtime.LogInfo(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while running aggregation pipeline"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while running aggregation pipeline"), zenity.ErrorIcon) return } diff --git a/internal/app/collection_find.go b/internal/app/collection_find.go index 688585d..316a253 100644 --- a/internal/app/collection_find.go +++ b/internal/app/collection_find.go @@ -30,7 +30,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey, formJson string) QueryResult { if err != nil { runtime.LogError(a.ctx, "Could not parse find form:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not parse form"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not parse form"), zenity.ErrorIcon) return out } @@ -48,7 +48,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey, formJson string) QueryResult { if err != nil { runtime.LogInfo(a.ctx, "Invalid find query:") runtime.LogInfo(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Invalid query"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Invalid query"), zenity.ErrorIcon) return out } @@ -56,7 +56,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey, formJson string) QueryResult { if err != nil { runtime.LogInfo(a.ctx, "Invalid find projection:") runtime.LogInfo(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Invalid projection"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Invalid projection"), zenity.ErrorIcon) return out } @@ -64,7 +64,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey, formJson string) QueryResult { if err != nil { runtime.LogInfo(a.ctx, "Invalid find sort:") runtime.LogInfo(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Invalid sort"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Invalid sort"), zenity.ErrorIcon) return out } @@ -79,7 +79,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey, formJson string) QueryResult { if err != nil { runtime.LogWarning(a.ctx, "Encountered an error while counting documents:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while counting docs"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while counting docs"), zenity.ErrorIcon) return out } @@ -87,7 +87,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey, formJson string) QueryResult { if err != nil { runtime.LogWarning(a.ctx, "Encountered an error while performing query:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while querying"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while querying"), zenity.ErrorIcon) return out } @@ -98,7 +98,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey, formJson string) QueryResult { if err != nil { runtime.LogWarning(a.ctx, "Encountered an error while performing query:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while querying"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while querying"), zenity.ErrorIcon) return out } @@ -109,7 +109,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey, formJson string) QueryResult { if err != nil { runtime.LogError(a.ctx, "Failed to marshal find BSON:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Failed to marshal JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Failed to marshal JSON"), zenity.ErrorIcon) return out } out.Results = append(out.Results, string(marshalled)) diff --git a/internal/app/collection_find_queries.go b/internal/app/collection_find_queries.go index 6300642..50cf591 100644 --- a/internal/app/collection_find_queries.go +++ b/internal/app/collection_find_queries.go @@ -64,7 +64,7 @@ func (a *App) SaveQuery(jsonData string) string { if err != nil { runtime.LogError(a.ctx, "Add query: malformed form") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Malformed JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Malformed JSON"), zenity.ErrorIcon) return "" } @@ -72,7 +72,7 @@ func (a *App) SaveQuery(jsonData string) string { queries[query.Name] = query err = updateQueryFile(a, queries) if err != nil { - zenity.Info(err.Error(), zenity.Title("Could not update query list"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not update query list"), zenity.ErrorIcon) return "" } @@ -83,7 +83,7 @@ func (a *App) RemoveQuery(queryName string) { queries := a.SavedQueries() delete(queries, queryName) if err := updateQueryFile(a, queries); err != nil { - zenity.Info(err.Error(), zenity.Title("Could not update query list"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not update query list"), zenity.ErrorIcon) } } @@ -93,13 +93,13 @@ func (a *App) UpdateQueries(jsonData string) bool { if err != nil { runtime.LogError(a.ctx, "Update queries: malformed form") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Malformed JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Malformed JSON"), zenity.ErrorIcon) return false } err = updateQueryFile(a, queries) if err != nil { - zenity.Info(err.Error(), zenity.Title("Could not save queries"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not save queries"), zenity.ErrorIcon) return false } diff --git a/internal/app/collection_indexes.go b/internal/app/collection_indexes.go index 834c9b8..c71bb04 100644 --- a/internal/app/collection_indexes.go +++ b/internal/app/collection_indexes.go @@ -22,7 +22,7 @@ func (a *App) GetIndexes(hostKey, dbKey, collKey string) []bson.M { if err != nil { runtime.LogWarning(a.ctx, "Encountered an error while creating index cursor:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while creating cursor"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while creating cursor"), zenity.ErrorIcon) return nil } @@ -31,7 +31,7 @@ func (a *App) GetIndexes(hostKey, dbKey, collKey string) []bson.M { if err != nil { runtime.LogWarning(a.ctx, "Encountered an error while executing index cursor:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while running cursor"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while running cursor"), zenity.ErrorIcon) return nil } @@ -63,7 +63,7 @@ func (a *App) CreateIndex(hostKey, dbKey, collKey, jsonData string) string { if err != nil { runtime.LogError(a.ctx, "Could not parse index JSON:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) return "" } @@ -93,7 +93,7 @@ func (a *App) CreateIndex(hostKey, dbKey, collKey, jsonData string) string { if err != nil { runtime.LogWarning(a.ctx, "Encountered an error while creating index:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while creating index"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while creating index"), zenity.ErrorIcon) return "" } @@ -111,7 +111,7 @@ func (a *App) DropIndex(hostKey, dbKey, collKey, indexName string) bool { if err != nil { runtime.LogError(a.ctx, "Encountered an error while creating index drop cursor:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while creating drop cursor"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while creating drop cursor"), zenity.ErrorIcon) return false } diff --git a/internal/app/collection_insert.go b/internal/app/collection_insert.go index b41f89d..89d8662 100644 --- a/internal/app/collection_insert.go +++ b/internal/app/collection_insert.go @@ -20,7 +20,7 @@ func (a *App) InsertItems(hostKey, dbKey, collKey, jsonData string) interface{} if err != nil { runtime.LogError(a.ctx, "Could not parse insert JSON:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) return nil } @@ -34,7 +34,7 @@ func (a *App) InsertItems(hostKey, dbKey, collKey, jsonData string) interface{} if err != nil { runtime.LogWarning(a.ctx, "Encountered an error while performing insert:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while performing insert"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while performing insert"), zenity.ErrorIcon) return nil } diff --git a/internal/app/collection_remove.go b/internal/app/collection_remove.go index 17018af..4835d04 100644 --- a/internal/app/collection_remove.go +++ b/internal/app/collection_remove.go @@ -24,7 +24,7 @@ func (a *App) RemoveItems(hostKey, dbKey, collKey, jsonData string, many bool) i if err != nil { runtime.LogError(a.ctx, "Could not parse remove query:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) return 0 } } @@ -47,7 +47,7 @@ func (a *App) RemoveItems(hostKey, dbKey, collKey, jsonData string, many bool) i if err != nil { runtime.LogWarning(a.ctx, "Encountered an error while performing remove:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while performing remove"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while performing remove"), zenity.ErrorIcon) return 0 } @@ -68,7 +68,7 @@ func (a *App) RemoveItemById(hostKey, dbKey, collKey, itemId string) bool { if err != nil && err != mongo.ErrNoDocuments { runtime.LogWarning(a.ctx, "Encountered an error while performing remove by id:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while performing remove"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while performing remove"), zenity.ErrorIcon) return false } diff --git a/internal/app/collection_update.go b/internal/app/collection_update.go index d0b8c71..aa85e8e 100644 --- a/internal/app/collection_update.go +++ b/internal/app/collection_update.go @@ -26,7 +26,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64 if err != nil { runtime.LogError(a.ctx, "Could not parse update form:") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not parse form"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not parse form"), zenity.ErrorIcon) return 0 } @@ -44,7 +44,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64 runtime.LogWarning(a.ctx, "Invalid update query:") runtime.LogWarning(a.ctx, form.Query) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Invalid update query"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Invalid update query"), zenity.ErrorIcon) return 0 } @@ -57,7 +57,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64 runtime.LogWarning(a.ctx, "Invalid update parameter value:") runtime.LogWarning(a.ctx, param.Value) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Invalid update query"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Invalid update query"), zenity.ErrorIcon) return 0 } } @@ -74,7 +74,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64 if err != nil { runtime.LogWarning(a.ctx, "Encountered an error while performing update:") runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while performing update"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while performing update"), zenity.ErrorIcon) return 0 } diff --git a/internal/app/connection.go b/internal/app/connection.go index 4c39216..d2f0153 100644 --- a/internal/app/connection.go +++ b/internal/app/connection.go @@ -15,14 +15,14 @@ import ( func (a *App) connectToHost(hostKey string) (*mongo.Client, context.Context, func(), error) { hosts, err := a.Hosts() if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while getting hosts"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while getting hosts"), zenity.ErrorIcon) return nil, nil, nil, errors.New("could not retrieve hosts") } h := hosts[hostKey] if len(h.URI) == 0 { runtime.LogInfo(a.ctx, "Invalid URI (len == 0) for host "+hostKey) - zenity.Info("You haven't specified a valid uri for the selected host.", zenity.Title("Invalid query"), zenity.ErrorIcon) + zenity.Warning("You haven't specified a valid uri for the selected host.", zenity.Title("Invalid query"), zenity.WarningIcon) return nil, nil, nil, errors.New("invalid uri") } @@ -31,7 +31,7 @@ func (a *App) connectToHost(hostKey string) (*mongo.Client, context.Context, fun if err != nil { runtime.LogWarning(a.ctx, "Could not connect to host "+hostKey) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while connecting to "+h.Name), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while connecting to "+h.Name), zenity.ErrorIcon) return nil, nil, nil, errors.New("could not establish a connection with " + h.Name) } @@ -52,7 +52,7 @@ func (a *App) OpenConnection(hostKey string) (databases []string) { if err != nil { runtime.LogWarning(a.ctx, "Could not retrieve database names for host "+hostKey) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while getting databases"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while getting databases"), zenity.ErrorIcon) return nil } defer close() diff --git a/internal/app/database.go b/internal/app/database.go index b3cf02f..26ee8e8 100644 --- a/internal/app/database.go +++ b/internal/app/database.go @@ -16,7 +16,7 @@ func (a *App) OpenDatabase(hostKey, dbKey string) (collections []string) { if err != nil { runtime.LogWarning(a.ctx, "Could not retrieve collection list for db "+dbKey) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while getting collections"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while getting collections"), zenity.ErrorIcon) return nil } @@ -39,7 +39,7 @@ func (a *App) DropDatabase(hostKey, dbKey string) bool { if err != nil { runtime.LogWarning(a.ctx, "Could not drop db "+dbKey) runtime.LogWarning(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while dropping database"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while dropping database"), zenity.ErrorIcon) return false } diff --git a/internal/app/database_export.go b/internal/app/database_export.go index 635e597..47b39e6 100644 --- a/internal/app/database_export.go +++ b/internal/app/database_export.go @@ -33,13 +33,13 @@ func (a *App) PerformExport(jsonData string) bool { if err != nil { runtime.LogError(a.ctx, "Could not unmarshal export form") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) return false } hosts, err := a.Hosts() if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while getting hosts"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while getting hosts"), zenity.ErrorIcon) return false } host := hosts[info.HostKey] @@ -51,7 +51,7 @@ func (a *App) PerformExport(jsonData string) bool { case FileTypeDump: if !a.Env.HasMongoDump { - zenity.Info("You need to install mongodump to perform a dump.", zenity.Title("Additional software required"), zenity.ErrorIcon) + zenity.Error("You need to install mongodump to perform a dump.", zenity.Title("Additional tooling required"), zenity.ErrorIcon) return false } @@ -82,7 +82,7 @@ func (a *App) PerformExport(jsonData string) bool { } default: - zenity.Info(fmt.Sprintf("File type '%v' is not known.", info.FileType), zenity.Title("Unrecognised file type"), zenity.ErrorIcon) + zenity.Error(fmt.Sprintf("File type '%v' is not known.", info.FileType), zenity.Title("Unrecognised file type"), zenity.ErrorIcon) return false } diff --git a/internal/app/hosts.go b/internal/app/hosts.go index 1fce7af..66f57d9 100644 --- a/internal/app/hosts.go +++ b/internal/app/hosts.go @@ -57,7 +57,7 @@ func (a *App) Hosts() (map[string]Host, error) { func (a *App) AddHost(jsonData string) error { hosts, err := a.Hosts() if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while retrieving hosts"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while retrieving hosts"), zenity.ErrorIcon) return errors.New("could not retrieve existing host list") } @@ -66,7 +66,7 @@ func (a *App) AddHost(jsonData string) error { if err != nil { runtime.LogError(a.ctx, "Add host: malformed form") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) return errors.New("invalid JSON") } @@ -74,14 +74,14 @@ func (a *App) AddHost(jsonData string) error { if err != nil { runtime.LogError(a.ctx, "Add host: failed to generate a UUID") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Error while generating UUID"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while generating UUID"), zenity.ErrorIcon) return errors.New("could not generate a UUID") } hosts[id.String()] = newHost err = updateHostsFile(a, hosts) if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while updating host list"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while updating host list"), zenity.ErrorIcon) return errors.New("could not update host list") } @@ -91,7 +91,7 @@ func (a *App) AddHost(jsonData string) error { func (a *App) UpdateHost(hostKey string, jsonData string) error { hosts, err := a.Hosts() if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while getting hosts"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while getting hosts"), zenity.ErrorIcon) return errors.New("could not retrieve existing host list") } @@ -100,14 +100,14 @@ func (a *App) UpdateHost(hostKey string, jsonData string) error { if err != nil { runtime.LogError(a.ctx, "Could not parse update host JSON") runtime.LogError(a.ctx, err.Error()) - zenity.Info(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) return errors.New("invalid JSON") } hosts[hostKey] = host err = updateHostsFile(a, hosts) if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while updating hosts"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while updating hosts"), zenity.ErrorIcon) return errors.New("could not update host list") } @@ -117,7 +117,7 @@ func (a *App) UpdateHost(hostKey string, jsonData string) error { func (a *App) RemoveHost(key string) error { hosts, err := a.Hosts() if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while retrieving hosts"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while retrieving hosts"), zenity.ErrorIcon) return errors.New("could not retrieve existing host list") } @@ -130,7 +130,7 @@ func (a *App) RemoveHost(key string) error { err = updateHostsFile(a, hosts) if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while updating hosts"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while updating hosts"), zenity.ErrorIcon) return errors.New("could not update host list") } return nil diff --git a/internal/app/views.go b/internal/app/views.go index 57d2274..9b7c435 100644 --- a/internal/app/views.go +++ b/internal/app/views.go @@ -101,13 +101,13 @@ func (a *App) UpdateViewStore(jsonData string) error { var viewStore ViewStore err := json.Unmarshal([]byte(jsonData), &viewStore) if err != nil { - zenity.Info(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Could not parse JSON"), zenity.ErrorIcon) return errors.New("invalid JSON") } err = updateViewStore(a, viewStore) if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while updating view store"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while updating view store"), zenity.ErrorIcon) return errors.New("could not update view store") } @@ -117,7 +117,7 @@ func (a *App) UpdateViewStore(jsonData string) error { func (a *App) RemoveView(viewKey string) error { views, err := a.Views() if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while getting views"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while getting views"), zenity.ErrorIcon) return errors.New("could not retrieve existing view store") } @@ -130,7 +130,7 @@ func (a *App) RemoveView(viewKey string) error { err = updateViewStore(a, views) if err != nil { - zenity.Info(err.Error(), zenity.Title("Error while updating view store"), zenity.ErrorIcon) + zenity.Error(err.Error(), zenity.Title("Error while updating view store"), zenity.ErrorIcon) return errors.New("could not update view store") } return nil