Better imgproxyError handling

This commit is contained in:
DarthSim
2021-03-22 22:45:37 +06:00
parent cfe9578f50
commit 08b70d8b91
3 changed files with 9 additions and 9 deletions

View File

@@ -55,6 +55,13 @@ func newUnexpectedError(msg string, skip int) *imgproxyError {
}
}
func wrapError(err error, skip int) *imgproxyError {
if ierr, ok := err.(*imgproxyError); ok {
return ierr
}
return newUnexpectedError(err.Error(), skip+1)
}
func callers(skip int) []uintptr {
stack := make([]uintptr, 10)
n := runtime.Callers(skip, stack)