|
@@ -20,14 +20,17 @@ func newError(status int, msg string, pub string) *imgproxyError {
|
|
|
return &imgproxyError{status, msg, pub}
|
|
|
}
|
|
|
|
|
|
-func newUnexpectedError(err error, skip int) *imgproxyError {
|
|
|
- msg := fmt.Sprintf("Unexpected error: %s\n%s", err, stacktrace(skip+1))
|
|
|
- return &imgproxyError{500, msg, "Internal error"}
|
|
|
+func newUnexpectedError(msg string, skip int) *imgproxyError {
|
|
|
+ return &imgproxyError{
|
|
|
+ 500,
|
|
|
+ fmt.Sprintf("Unexpected error: %s\n%s", msg, stacktrace(skip+3)),
|
|
|
+ "Internal error",
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func stacktrace(skip int) string {
|
|
|
callers := make([]uintptr, 10)
|
|
|
- n := runtime.Callers(skip+1, callers)
|
|
|
+ n := runtime.Callers(skip, callers)
|
|
|
|
|
|
lines := make([]string, n)
|
|
|
for i, pc := range callers[:n] {
|