Просмотр исходного кода

Also log caller line number in ContextError

Rod Hynes 11 лет назад
Родитель
Сommit
43fb2c9219
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      psiphon/utils.go

+ 2 - 2
psiphon/utils.go

@@ -77,9 +77,9 @@ func TrimError(err error) error {
 
 // ContextError prefixes an error message with the current function name
 func ContextError(err error) error {
-	pc, _, _, _ := runtime.Caller(1)
+	pc, _, line, _ := runtime.Caller(1)
 	funcName := runtime.FuncForPC(pc).Name()
-	return fmt.Errorf("%s: %s", funcName, err)
+	return fmt.Errorf("%s#%d: %s", funcName, line, err)
 }
 
 func MakeSessionId() (id string, err error) {