From 06c132ab0d8e96dd896617db9bf8afb7be0e0e82 Mon Sep 17 00:00:00 2001 From: malashin Date: Tue, 23 Jun 2020 16:38:07 +0300 Subject: [PATCH] Add filepath to texture error message --- gui.go | 1 + misc.go | 2 +- render.go | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gui.go b/gui.go index c198661..537e988 100644 --- a/gui.go +++ b/gui.go @@ -236,6 +236,7 @@ func start() { } } + ansi.Println("\x1b[33;1m" + "Generating images:" + "\x1b[0m") var i float64 = 8 // Replace hoi4 textures if mods has the same ones. useModsTexturesIfPresent() diff --git a/misc.go b/misc.go index d5a0705..bdcae5e 100644 --- a/misc.go +++ b/misc.go @@ -377,7 +377,7 @@ func showError(err error) { w.CenterOnScreen() w.SetFixedSize(true) w.Show() - w.RequestFocus() + // w.RequestFocus() pBar.Hide() pBar.SetValue(0) diff --git a/render.go b/render.go index 6ce2ac9..2fb347f 100644 --- a/render.go +++ b/render.go @@ -29,7 +29,7 @@ func renderFocus(dst draw.Image, x, y int, id string) error { err := renderSprite(dst, x+gui.BG.Position.X, y+gui.BG.Position.Y, gui.BG.Orientation, gui.BG.CenterPosition, s) if err != nil { - return err + return fmt.Errorf("%q: %v", s.TextureFile, err) } symbol, ok := gfxMap[f.Icon] @@ -39,7 +39,7 @@ func renderFocus(dst draw.Image, x, y int, id string) error { err = renderSprite(dst, x+gui.Symbol.Position.X, y+gui.Symbol.Position.Y, gui.Symbol.Orientation, gui.Symbol.CenterPosition, symbol) if err != nil { - return err + return fmt.Errorf("%q: %v", symbol.TextureFile, err) } text := f.Text @@ -422,14 +422,14 @@ func (s *SpriteType) readTexture() error { } } - return fmt.Errorf(err.Error()) + return err } TextureFileFound: defer imgFile.Close() s.Image, _, err = image.Decode(imgFile) if err != nil { - return fmt.Errorf(err.Error()) + return err } return nil }