forked from portapps/portapps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog.go
35 lines (29 loc) · 776 Bytes
/
dialog.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package portapps
import (
"fmt"
"os"
"github.com/portapps/portapps/v3/pkg/log"
"github.com/portapps/portapps/v3/pkg/win"
)
// ErrorBox display an error message box
func (app *App) ErrorBox(msg interface{}) {
_, _ = win.MsgBox(
fmt.Sprintf("%s portable", app.Name),
fmt.Sprintf("%v", msg),
win.MsgBoxBtnOk|win.MsgBoxIconError)
}
// ErrorBoxLog display an error message box nad log
func (app *App) ErrorBoxLog(msg interface{}) {
log.Error().Msgf("%s", msg)
app.ErrorBox(msg)
}
// FatalBox display an error message box and exit
func (app *App) FatalBox(msg interface{}) {
app.ErrorBox(msg)
os.Exit(1)
}
// FatalBoxLog display an error message box, log and exit
func (app *App) FatalBoxLog(msg interface{}) {
log.Error().Msgf("%s", msg)
app.FatalBox(msg)
}