1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-27 21:05:53 +00:00

Extract JSON error instead of re-encoding it

This commit is contained in:
Kane York 2017-09-15 16:08:23 -07:00
parent ad1296e0ed
commit 537800956a

View file

@ -439,14 +439,6 @@ type bunchSubscriberList struct {
Members []bunchSubscriber
}
type cacheStatus byte
const (
CacheStatusNotFound = iota
CacheStatusFound
CacheStatusExpired
)
var bunchGroup singleflight.Group
// C2SHandleBunchedCommand handles C2S Commands such as `get_link`.
@ -465,7 +457,11 @@ func C2SHandleBunchedCommand(conn *websocket.Conn, client *ClientInfo, msg Clien
reply.MessageID = msg.MessageID
if result.Err != nil {
reply.Command = ErrorCommand
reply.Arguments = result.Err.Error()
if efb, ok := result.Err.(ErrForwardedFromBackend); ok {
reply.Arguments = efb.JSONError
} else {
reply.Arguments = result.Err.Error()
}
} else {
reply.Command = SuccessCommand
reply.origArguments = result.Val.(string)