Skip to content

Commit

Permalink
tidy up changes from previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
xEricL committed Sep 30, 2024
1 parent efd4722 commit 73488e8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/go-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- 'master'
- 'test/**'
paths:
- 'VERSION'

permissions:
contents: write
Expand Down
1 change: 0 additions & 1 deletion pinnacle.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (p *Pinnacle) cleanup(ctx context.Context, err error) {
if err == nil {
return
}
p.CaptureErr(ctx, err)
p.CaptureErr(ctx, ui.DisplayError(ctx, err, p.logFile))
p.CaptureErr(ctx, os.RemoveAll(p.alpinePath("launcher.jar")))
p.CaptureErr(ctx, os.RemoveAll(p.alpinePath("jre", "17")))
Expand Down
23 changes: 8 additions & 15 deletions ui/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"io"
"log"
"os"
"os/exec"
"runtime"
Expand All @@ -27,23 +26,17 @@ func DisplayError(ctx context.Context, err error, logFile *os.File) error {

var logContent string
if logFile != nil {
logFile.Close()
log.Println("reading log file again at: " + logFile.Name())
logFileToRead, lerr := os.Open(logFile.Name())
if lerr != nil {
log.Printf("error opening log file %q: %v", logFile.Name(), lerr)
} else {
defer logFileToRead.Close()
logData, rerr := io.ReadAll(logFileToRead)
if rerr != nil {
log.Println(errors.Unwrap(rerr))
} else {
log.Println("attaching log file to sentry report")
_ = logFile.Close()
logFileToRead, ler := os.Open(logFile.Name())
if ler == nil {
defer func() {
_ = logFileToRead.Close()
}()
logData, rer := io.ReadAll(logFileToRead)
if rer == nil {
logContent = string(logData)
log.Printf("length of log: %d\n", len(logContent))
}
}

}

id := sentry.CaptureErr(ctx, err, logContent)
Expand Down
2 changes: 1 addition & 1 deletion ui/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ const (
func NotifyNewUpdate() {
const msg = "Update available!\n\nPlease visit " + downloadURL

log.Printf("[INFO] %s", msg)
log.Println(msg)
_ = zenity.Notify(msg, zenity.Title(WindowTitle))
}
2 changes: 1 addition & 1 deletion ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func Render() {
zenity.Height(uint(WindowHeight)),
)
if err != nil {
log.Printf("[ERROR] failed to render progress bar: %v", err)
log.Printf("[ERROR] failed to render progress bar: %v\n", err)
dialog = nil
}
}
Expand Down

0 comments on commit 73488e8

Please sign in to comment.