Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(14)

Side by Side Diff: src/pkg/rpc/jsonrpc/client.go

Issue 2308043: code review 2308043: Use Errorf where appropriate. (Closed)
Patch Set: code review 2308043: Use Errorf where appropriate. Created 14 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/image/png/writer_test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec 5 // Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec
6 // for the rpc package. 6 // for the rpc package.
7 package jsonrpc 7 package jsonrpc
8 8
9 import ( 9 import (
10 "fmt" 10 "fmt"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 c.mutex.Lock() 80 c.mutex.Lock()
81 r.ServiceMethod = c.pending[c.resp.Id] 81 r.ServiceMethod = c.pending[c.resp.Id]
82 c.pending[c.resp.Id] = "", false 82 c.pending[c.resp.Id] = "", false
83 c.mutex.Unlock() 83 c.mutex.Unlock()
84 84
85 r.Error = "" 85 r.Error = ""
86 r.Seq = c.resp.Id 86 r.Seq = c.resp.Id
87 if c.resp.Error != nil { 87 if c.resp.Error != nil {
88 x, ok := c.resp.Error.(string) 88 x, ok := c.resp.Error.(string)
89 if !ok { 89 if !ok {
90 » » » return os.NewError(fmt.Sprintf("invalid error %v", c.res p.Error)) 90 » » » return fmt.Errorf("invalid error %v", c.resp.Error)
91 } 91 }
92 if x == "" { 92 if x == "" {
93 x = "unspecified error" 93 x = "unspecified error"
94 } 94 }
95 r.Error = x 95 r.Error = x
96 } 96 }
97 return nil 97 return nil
98 } 98 }
99 99
100 func (c *clientCodec) ReadResponseBody(x interface{}) os.Error { 100 func (c *clientCodec) ReadResponseBody(x interface{}) os.Error {
(...skipping 11 matching lines...) Expand all
112 } 112 }
113 113
114 // Dial connects to a JSON-RPC server at the specified network address. 114 // Dial connects to a JSON-RPC server at the specified network address.
115 func Dial(network, address string) (*rpc.Client, os.Error) { 115 func Dial(network, address string) (*rpc.Client, os.Error) {
116 conn, err := net.Dial(network, "", address) 116 conn, err := net.Dial(network, "", address)
117 if err != nil { 117 if err != nil {
118 return nil, err 118 return nil, err
119 } 119 }
120 return NewClient(conn), err 120 return NewClient(conn), err
121 } 121 }
OLDNEW
« no previous file with comments | « src/pkg/image/png/writer_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b