mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-07-22 15:18:02 +00:00
Logging
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
@ -10,13 +8,13 @@ import (
|
||||
func (a *App) OpenDatabase(hostKey, dbKey string) (collections []string) {
|
||||
client, ctx, close, err := a.connectToHost(hostKey)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return nil
|
||||
}
|
||||
|
||||
collections, err = client.Database(dbKey).ListCollectionNames(ctx, bson.D{})
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
runtime.LogWarning(a.ctx, "Could not retrieve collection list for db "+dbKey)
|
||||
runtime.LogWarning(a.ctx, err.Error())
|
||||
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
|
||||
Type: runtime.ErrorDialog,
|
||||
Title: "Could not retrieve collection list for " + dbKey,
|
||||
@ -43,13 +41,13 @@ func (a *App) DropDatabase(hostKey, dbKey string) bool {
|
||||
|
||||
client, ctx, close, err := a.connectToHost(hostKey)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return false
|
||||
}
|
||||
|
||||
err = client.Database(dbKey).Drop(ctx)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
runtime.LogWarning(a.ctx, "Could not drop db "+dbKey)
|
||||
runtime.LogWarning(a.ctx, err.Error())
|
||||
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
|
||||
Type: runtime.ErrorDialog,
|
||||
Title: "Could not drop " + dbKey,
|
||||
|
Reference in New Issue
Block a user