mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-07-06 20:42:33 +02:00
Add fatal error when port is already in use
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -55,6 +55,7 @@ type Model struct {
|
||||
database *db.DB
|
||||
logFile *os.File
|
||||
pluginManager *plugins.Manager
|
||||
fatalErr error
|
||||
|
||||
width int
|
||||
height int
|
||||
@@ -135,6 +136,8 @@ func New(broker *intercept.Broker, name, path string) Model {
|
||||
return m
|
||||
}
|
||||
|
||||
func (m Model) FatalErr() error { return m.fatalErr }
|
||||
|
||||
func (m Model) Init() tea.Cmd {
|
||||
mgr := m.pluginManager
|
||||
return tea.Batch(
|
||||
|
||||
@@ -107,16 +107,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case proxyPkg.ErrMsg:
|
||||
if msg.Err != nil {
|
||||
log.Printf("proxy error: %v", msg.Err)
|
||||
return m, tea.Batch(
|
||||
func() tea.Msg {
|
||||
return notificationsUI.NotificationMsg{
|
||||
Title: "Proxy Error",
|
||||
Body: msg.Err.Error(),
|
||||
Kind: notificationsUI.KindError,
|
||||
}
|
||||
},
|
||||
tea.Quit,
|
||||
)
|
||||
m.fatalErr = msg.Err
|
||||
return m, tea.Quit
|
||||
}
|
||||
return m, nil
|
||||
|
||||
|
||||
Reference in New Issue
Block a user