cmoparing errors with strings now

This commit is contained in:
Travis
2013-01-01 19:57:14 -08:00
parent 4e2a543f6e
commit 8d22186ec6

View File

@@ -15,7 +15,7 @@ import (
"github.com/iron-io/iron_go/worker" "github.com/iron-io/iron_go/worker"
"log" "log"
"math/rand" "math/rand"
"net" // "net"
"net/http" "net/http"
"net/url" "net/url"
"reflect" "reflect"
@@ -91,7 +91,8 @@ func ProxyFunc(w http.ResponseWriter, req *http.Request) {
etype := reflect.TypeOf(err) etype := reflect.TypeOf(err)
fmt.Println("err type:", etype) fmt.Println("err type:", etype)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
if etype == reflect.TypeOf(net.OpError{}) { // couldn't figure out a better way to do this // can't figure out how to compare types so comparing strings.... lame.
if strings.Contains(etype.String(), "net.OpError") { // == reflect.TypeOf(net.OpError{}) { // couldn't figure out a better way to do this
fmt.Println("It's a network error, so we're going to start new task.") fmt.Println("It's a network error, so we're going to start new task.")
// start new worker // start new worker
payload := map[string]interface{}{ payload := map[string]interface{}{