mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-09-30 09:37:49 +00:00
Bump version of imaging
imaging is now panic safe. Also format nested panics a bit better.
This commit is contained in:
parent
f067e9cd92
commit
37bd77f4a8
3 changed files with 13 additions and 5 deletions
|
|
@ -73,8 +73,16 @@ func Format_stacktrace_on_panic(r any) (text string, err error) {
|
|||
n := runtime.Callers(3, pcs)
|
||||
lines := []string{}
|
||||
frames := runtime.CallersFrames(pcs[:n])
|
||||
err = fmt.Errorf("Panicked: %s", r)
|
||||
lines = append(lines, fmt.Sprintf("\r\nPanicked with error: %s\r\nStacktrace (most recent call first):\r\n", r))
|
||||
rt := fmt.Sprint(r)
|
||||
if strings.HasPrefix(rt, "Panicked with error:") {
|
||||
err = fmt.Errorf("%s", rt)
|
||||
lines = append(lines, "Panic caused by previous panic (probably in a gouroutine). Previous panic:\r\n")
|
||||
lines = append(lines, rt)
|
||||
lines = append(lines, "\r\n\r\nStacktrace of current panic (most recent call first):\r\n")
|
||||
} else {
|
||||
err = fmt.Errorf("Panicked: %s", r)
|
||||
lines = append(lines, fmt.Sprintf("\r\nPanicked with error: %s\r\nStacktrace (most recent call first):\r\n", r))
|
||||
}
|
||||
found_first_frame := false
|
||||
for frame, more := frames.Next(); more; frame, more = frames.Next() {
|
||||
if !found_first_frame {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue