FunLocks / team2001

Team01:よわよわ feat. よっすー
4 stars 2 forks source link

geoparserの例外処理 #126

Closed materialofmouse closed 3 years ago

materialofmouse commented 3 years ago

はこだてでしかうごかない。

t4t5u0 commented 3 years ago
go-gin    | 2020/12/17 21:29:09 [Recovery] 2020/12/17 - 21:29:09 panic recovered:
go-gin    | POST /post HTTP/1.1
go-gin    | Host: 153.120.166.49:8080
go-gin    | Accept: */*
go-gin    | Content-Length: 67
go-gin    | Content-Type: application/json
go-gin    | User-Agent: curl/7.73.0
go-gin    | 
go-gin    | 
go-gin    | runtime error: index out of range [0] with length 0
go-gin    | /usr/local/go/src/runtime/panic.go:88 (0x4351a4)
go-gin    |     goPanicIndex: panic(boundsError{x: int64(x), signed: true, y: y, code: boundsIndex})
go-gin    | /app/geocode/geocode.go:99 (0xa495ef)
go-gin    |     toJSON: fmt.Println(data.Results[0])
go-gin    | /app/geocode/geocode.go:31 (0xa48bee)
go-gin    |     GetAddressFromCoord: result, err = toJSON(URL)
go-gin    | /app/query/query.go:29 (0xa49de9)
go-gin    |     PostFromApp.func1: geo.Geodata = *geocode.GetAddressFromCoord(geo.Latitude, geo.Longitude)
go-gin    | /go/src/github.com/gin-gonic/gin/context.go:165 (0x96d7ba)
go-gin    |     (*Context).Next: c.handlers[c.index](c)
go-gin    | /go/src/github.com/gin-gonic/gin/recovery.go:99 (0x981d28)
go-gin    |     CustomRecoveryWithWriter.func1: c.Next()
go-gin    | /go/src/github.com/gin-gonic/gin/context.go:165 (0x96d7ba)
go-gin    |     (*Context).Next: c.handlers[c.index](c)
go-gin    | /go/src/github.com/gin-gonic/gin/logger.go:241 (0x980e64)
go-gin    |     LoggerWithConfig.func1: c.Next()
go-gin    | /go/src/github.com/gin-gonic/gin/context.go:165 (0x96d7ba)
go-gin    |     (*Context).Next: c.handlers[c.index](c)
go-gin    | /go/src/github.com/gin-gonic/gin/gin.go:420 (0x977cd7)
go-gin    |     (*Engine).handleHTTPRequest: c.Next()
go-gin    | /go/src/github.com/gin-gonic/gin/gin.go:376 (0x97743b)
go-gin    |     (*Engine).ServeHTTP: engine.handleHTTPRequest(c)
go-gin    | /usr/local/go/src/net/http/server.go:2843 (0x6e08a2)
go-gin    |     serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
go-gin    | /usr/local/go/src/net/http/server.go:1925 (0x6dbfac)
go-gin    |     (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
go-gin    | /usr/local/go/src/runtime/asm_amd64.s:1374 (0x46c640)
go-gin    |     goexit: BYTE    $0x90   // NOP
go-gin    | 
materialofmouse commented 3 years ago

函館はうまく言った。 ハードから実行したPOSTメソッド正常に終了。

t4t5u0 commented 3 years ago

ナイス。エラーはおれ後で見るからとりあえずはいいよ

t4t5u0 commented 3 years ago
go-gin    | JSON Unmarshal error: invalid character '<' looking for beginning of value
go-gin    | invalid character '<' looking for beginning of value

エラーがよくわからん

t4t5u0 commented 3 years ago
    town = strings.Replace(town, " ", "-", -1)
    city = strings.Replace(city, " ", "-", -1)

これでいけた