Handle unsupported message
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package kmb
|
package kmb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
query "github.com/tgckpg/golifehk/query"
|
query "github.com/tgckpg/golifehk/query"
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -42,6 +43,9 @@ func Query(q query.QueryMessage) query.IQueryResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
qo, err = query.MatchNearest(*q.Location, &bList, qr.NearestRange, qr.FallbackNearest)
|
qo, err = query.MatchNearest(*q.Location, &bList, qr.NearestRange, qr.FallbackNearest)
|
||||||
|
} else {
|
||||||
|
qr.Error = fmt.Errorf("unsupported message")
|
||||||
|
goto qrReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
qo.Message = &q
|
qo.Message = &q
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package bus
|
package bus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
query "github.com/tgckpg/golifehk/query"
|
query "github.com/tgckpg/golifehk/query"
|
||||||
@@ -29,6 +30,9 @@ func Query(q query.QueryMessage) query.IQueryResult {
|
|||||||
qBusStops, err = query.MatchKeys(strings.ToUpper(q.Text), busStops)
|
qBusStops, err = query.MatchKeys(strings.ToUpper(q.Text), busStops)
|
||||||
} else if q.Location != nil {
|
} else if q.Location != nil {
|
||||||
qBusStops, err = query.MatchNearest(*q.Location, busStops, qr.NearestRange, qr.FallbackNearest)
|
qBusStops, err = query.MatchNearest(*q.Location, busStops, qr.NearestRange, qr.FallbackNearest)
|
||||||
|
} else {
|
||||||
|
qr.Error = fmt.Errorf("unsupported message")
|
||||||
|
goto qrReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user