mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-28 15:27:43 +00:00
Merge pull request #235 from riking/patch-4
Extract JSON error instead of re-encoding it
This commit is contained in:
commit
d208fcb3b6
1 changed files with 5 additions and 9 deletions
|
@ -425,14 +425,6 @@ type bunchSubscriberList struct {
|
||||||
Members []bunchSubscriber
|
Members []bunchSubscriber
|
||||||
}
|
}
|
||||||
|
|
||||||
type cacheStatus byte
|
|
||||||
|
|
||||||
const (
|
|
||||||
CacheStatusNotFound = iota
|
|
||||||
CacheStatusFound
|
|
||||||
CacheStatusExpired
|
|
||||||
)
|
|
||||||
|
|
||||||
var bunchGroup singleflight.Group
|
var bunchGroup singleflight.Group
|
||||||
|
|
||||||
// C2SHandleBunchedCommand handles C2S Commands such as `get_link`.
|
// C2SHandleBunchedCommand handles C2S Commands such as `get_link`.
|
||||||
|
@ -451,7 +443,11 @@ func C2SHandleBunchedCommand(conn *websocket.Conn, client *ClientInfo, msg Clien
|
||||||
reply.MessageID = msg.MessageID
|
reply.MessageID = msg.MessageID
|
||||||
if result.Err != nil {
|
if result.Err != nil {
|
||||||
reply.Command = ErrorCommand
|
reply.Command = ErrorCommand
|
||||||
|
if efb, ok := result.Err.(ErrForwardedFromBackend); ok {
|
||||||
|
reply.Arguments = efb.JSONError
|
||||||
|
} else {
|
||||||
reply.Arguments = result.Err.Error()
|
reply.Arguments = result.Err.Error()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
reply.Command = SuccessCommand
|
reply.Command = SuccessCommand
|
||||||
reply.origArguments = result.Val.(string)
|
reply.origArguments = result.Val.(string)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue