typo
diff --git a/airbrake.go b/airbrake.go
index 1a96118..3853095 100644
--- a/airbrake.go
+++ b/airbrake.go
@@ -13,7 +13,7 @@
"text/template"
)
-aivar (
+var (
ApiKey = ""
Endpoint = "https://api.airbrake.io/notifier_api/v2/notices"
Verbose = false
@@ -140,19 +140,19 @@
params["Backtrace"] = stacktrace(3)
- post(params)
+ post(params)
- return nil
+ return nil
}
func Notify(e error) error {
- once.Do(initChannel)
-
- if ApiKey == "" {
- return apiKeyMissing
- }
-
- params := map[string]interface{}{
+ once.Do(initChannel)
+
+ if ApiKey == "" {
+ return apiKeyMissing
+ }
+
+ params := map[string]interface{}{
"Class": reflect.TypeOf(e).String(),
"Error": e,
"ApiKey": ApiKey,
@@ -163,36 +163,36 @@
params["Class"] = "Panic"
}
- pwd, err := os.Getwd()
+ pwd, err := os.Getwd()
- if err == nil {
+ if err == nil {
params["Pwd"] = pwd
}
-
- hostname, err := os.Hostname()
+
+ hostname, err := os.Hostname()
- if err == nil {
+ if err == nil {
params["Hostname"] = hostname
- }
+ }
post(params)
return nil
-
+
}
func CapturePanic(r *http.Request) {
- if rec := recover(); rec != nil {
+ if rec := recover(); rec != nil {
- if err, ok := rec.(error); ok {
- log.Printf("Recording err %s", err)
- Error(err, r)
- } else if err, ok := rec.(string); ok {
- log.Printf("Recording string %s", err)
- Error(errors.New(err), r)
- }
+ if err, ok := rec.(error); ok {
+ log.Printf("Recording err %s", err)
+ Error(err, r)
+ } else if err, ok := rec.(string); ok {
+ log.Printf("Recording string %s", err)
+ Error(errors.New(err), r)
+ }
- panic(rec)
- }
+ panic(rec)
+ }
}
const source = `<?xml version="1.0" encoding="UTF-8"?>
diff --git a/airbrake_test.go b/airbrake_test.go
index ca71270..10000d1 100644
--- a/airbrake_test.go
+++ b/airbrake_test.go
@@ -8,9 +8,11 @@
"time"
)
+const API_KEY = ""
+
func TestError(t *testing.T) {
Verbose = true
- ApiKey = ""
+ ApiKey = API_KEY
Endpoint = "https://api.airbrake.io/notifier_api/v2/notices"
err := Error(errors.New("Test Error"), nil)
@@ -24,7 +26,7 @@
func TestRequest(t *testing.T) {
Verbose = true
- ApiKey = ""
+ ApiKey = API_KEY
Endpoint = "https://api.airbrake.io/notifier_api/v2/notices"
request, _ := http.NewRequest("GET", "/some/path?a=1", bytes.NewBufferString(""))
@@ -40,10 +42,10 @@
func TestNotify(t *testing.T) {
Verbose = true
- ApiKey = ""
+ ApiKey = API_KEY
Endpoint = "https://api.airbrake.io/notifier_api/v2/notices"
- err := Notify(errors.New("Test Error")
+ err := Notify(errors.New("Test Error"))
if err != nil {
t.Error(err)