gofmt
This commit is contained in:
parent
6443443c6b
commit
6bd36a59c5
3 changed files with 16 additions and 16 deletions
|
@ -293,7 +293,6 @@ func (a *authenticator) ValidateAccessToken(token AccessToken) *RefreshToken {
|
|||
return nil
|
||||
}
|
||||
|
||||
|
||||
return uvIssRT
|
||||
}
|
||||
|
||||
|
|
|
@ -80,9 +80,9 @@ func (b *Blas) Components() components.ComponentStore { return b.components }
|
|||
|
||||
func New(cfg *config.Config) (b *Blas, err error) {
|
||||
b = &Blas{
|
||||
Bus: bus.New(),
|
||||
Config: cfg,
|
||||
components: make(components.ComponentStore),
|
||||
Bus: bus.New(),
|
||||
Config: cfg,
|
||||
components: make(components.ComponentStore),
|
||||
WebSocketManager: wsapi.NewManager(),
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
|
||||
var (
|
||||
NoSuchHandlerErr = errors.New("bad websocket command")
|
||||
NoMessageIDErr = errors.New("no message ID")
|
||||
NoMessageIDErr = errors.New("no message ID")
|
||||
)
|
||||
|
||||
type Type string
|
||||
|
@ -122,28 +122,29 @@ type cmdMsg struct {
|
|||
}
|
||||
|
||||
type MsgType string
|
||||
|
||||
const (
|
||||
ResultMsgType MsgType = "result"
|
||||
)
|
||||
|
||||
type Error struct {
|
||||
Code string `json:"code"`
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type WSError struct {
|
||||
ID *int `json:"id,omitempty"`
|
||||
Type MsgType `json:"type"`
|
||||
Success bool `json:"success"`
|
||||
Error Error `json:"error"`
|
||||
ID *int `json:"id,omitempty"`
|
||||
Type MsgType `json:"type"`
|
||||
Success bool `json:"success"`
|
||||
Error Error `json:"error"`
|
||||
}
|
||||
|
||||
func (ws *cmdHandler) writeError(id int, err Error) error {
|
||||
return ws.WriteJSON(WSError{
|
||||
ID: &id,
|
||||
Type: ResultMsgType,
|
||||
ID: &id,
|
||||
Type: ResultMsgType,
|
||||
Success: false,
|
||||
Error: err,
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -163,10 +164,10 @@ func (ws *cmdHandler) handleMsg(r io.Reader) error {
|
|||
if !ok {
|
||||
return ws.WriteJSON(
|
||||
WSError{
|
||||
Type: ResultMsgType,
|
||||
Type: ResultMsgType,
|
||||
Success: false,
|
||||
Error: Error{
|
||||
Code: "invalid_id",
|
||||
Code: "invalid_id",
|
||||
Message: "command has no ID",
|
||||
},
|
||||
})
|
||||
|
@ -181,7 +182,7 @@ func (ws *cmdHandler) handleMsg(r io.Reader) error {
|
|||
case nil:
|
||||
case NoSuchHandlerErr:
|
||||
return ws.writeError(id, Error{
|
||||
Code: "invalid_type",
|
||||
Code: "invalid_type",
|
||||
Message: "no such command",
|
||||
})
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue