@@ -120,8 +120,8 @@ type pendingMap map[ID]chan *Response
120
120
type handlingMap map [ID ]handling
121
121
122
122
var (
123
- errLoadPendingMap = New (CodeInternalError , "failed to Load pendingMap" )
124
- errLoadhandlingMap = New (CodeInternalError , "failed to Load handlingMap" )
123
+ errLoadPendingMap = NewError (CodeInternalError , "failed to Load pendingMap" )
124
+ errLoadhandlingMap = NewError (CodeInternalError , "failed to Load handlingMap" )
125
125
)
126
126
127
127
// NewConn creates a new connection object that reads and writes messages from
@@ -244,7 +244,7 @@ func (c *Conn) Call(ctx context.Context, method string, params, result interface
244
244
// Reply sends a reply to the given request.
245
245
func (c * Conn ) Reply (ctx context.Context , req * Request , result interface {}, err error ) error {
246
246
if req .IsNotify () {
247
- return New (CodeInvalidRequest , "reply not invoked with a valid call" )
247
+ return NewError (CodeInvalidRequest , "reply not invoked with a valid call" )
248
248
}
249
249
250
250
m , ok := c .handling .Load ().(handlingMap )
@@ -267,7 +267,7 @@ func (c *Conn) Reply(ctx context.Context, req *Request, result interface{}, err
267
267
return err
268
268
}
269
269
} else {
270
- resp .Error = New (CodeParseError , err )
270
+ resp .Error = NewError (CodeParseError , err )
271
271
}
272
272
273
273
data , err := gojay .MarshalJSONObject (resp )
@@ -462,7 +462,7 @@ func (c *Conn) Run(ctx context.Context) (err error) {
462
462
close (rchan )
463
463
464
464
default :
465
- c .logger .Error (Receive , zap .Error (Errorf (CodeInvalidParams , "message not a call, notify or response, ignoring" )))
465
+ c .logger .Error (Receive , zap .Error (NewError (CodeInvalidParams , "message not a call, notify or response, ignoring" )))
466
466
}
467
467
}
468
468
}
0 commit comments