Skip to content

Commit

Permalink
Extract method
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Meyer committed Apr 9, 2015
1 parent 8c68195 commit 3aaa8ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type wire_protocol_parser struct {
func (parser *wire_protocol_parser) parse(command []byte) string {
var data []json.RawMessage
if err := json.Unmarshal(command, &data); err != nil {
return `["fail",{"message":"invalid command"}]`
return fail_response("invalid command")
}

var request string
Expand Down Expand Up @@ -102,3 +102,7 @@ func build_arguments_string(arguments []capturing_group) string {
}
return arguments_string
}

func fail_response(message string) string {
return `["fail",{"message":"` + message + `"}]`
}

0 comments on commit 3aaa8ad

Please sign in to comment.