Browse Source

Merge branch 'master' of https://github.com/Psiphon-Labs/psiphon-tunnel-core

Rod Hynes 6 years ago
parent
commit
f62830c473
1 changed files with 6 additions and 2 deletions
  1. 6 2
      psiphon/common/errors/errors.go

+ 6 - 2
psiphon/common/errors/errors.go

@@ -35,13 +35,17 @@ import (
 // TraceNew returns a new error with the given message, wrapped with the caller
 // stack frame information.
 func TraceNew(message string) error {
-	return Trace(fmt.Errorf("%s", message))
+	err := fmt.Errorf("%s", message)
+	pc, _, line, _ := runtime.Caller(1)
+	return fmt.Errorf("%s#%d: %w", stacktrace.GetFunctionName(pc), line, err)
 }
 
 // Tracef returns a new error with the given formatted message, wrapped with
 // the caller stack frame information.
 func Tracef(format string, args ...interface{}) error {
-	return Trace(fmt.Errorf(format, args...))
+	err := fmt.Errorf(format, args...)
+	pc, _, line, _ := runtime.Caller(1)
+	return fmt.Errorf("%s#%d: %w", stacktrace.GetFunctionName(pc), line, err)
 }
 
 // Trace wraps the given error with the caller stack frame information.