Skip to content

Commit

Permalink
Use extracted method
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Meyer committed Apr 9, 2015
1 parent 3aaa8ad commit 6067f03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (parser *wire_protocol_parser) parse(command []byte) string {

var request string
if err := json.Unmarshal(data[0], &request); err != nil {
return `["fail",{"message":"invalid command"}]`
return fail_response("invalid command")
}

return parser.evaluate(request, data)
Expand All @@ -41,7 +41,7 @@ func (parser *wire_protocol_parser) evaluate(request string, command []json.RawM
case "invoke":
return parser.invoke(command[1])
}
return `["fail",{"message":"unknown command: ` + request + `"}]`
return fail_response("unknown command: " + request)
}

func (parser *wire_protocol_parser) step_matches(parameters json.RawMessage) string {
Expand Down Expand Up @@ -75,7 +75,7 @@ func (parser *wire_protocol_parser) invoke(parameters json.RawMessage) string {
result, message := parser.steps.invoke_step(id, arguments)
switch result {
case fail:
return `["fail",{"message":"` + message + `"}]`
return fail_response(message)
case pending:
return `["pending"]`
}
Expand Down

0 comments on commit 6067f03

Please sign in to comment.