Skip to content

Commit 86cfe05

Browse files
committed
error: rename ErrorCode to Code
1 parent 56a5dd7 commit 86cfe05

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

error.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ import (
88
"fmt"
99
)
1010

11-
type ErrorCode int64
11+
type Code int64
1212

1313
const (
14-
CodeParseError ErrorCode = -32700
15-
CodeInvalidRequest ErrorCode = -32600
16-
CodeMethodNotFound ErrorCode = -32601
17-
CodeInvalidParams ErrorCode = -32602
18-
CodeInternalError ErrorCode = -32603
19-
CodeServerErrorStart ErrorCode = -32099
20-
CodeServerErrorEnd ErrorCode = -32000
21-
CodeServerNotInitialized ErrorCode = -32002
22-
CodeUnknownErrorCode ErrorCode = -32001
14+
CodeParseError Code = -32700
15+
CodeInvalidRequest Code = -32600
16+
CodeMethodNotFound Code = -32601
17+
CodeInvalidParams Code = -32602
18+
CodeInternalError Code = -32603
19+
CodeServerErrorStart Code = -32099
20+
CodeServerErrorEnd Code = -32000
21+
CodeServerNotInitialized Code = -32002
22+
CodeUnknownErrorCode Code = -32001
2323

2424
// Defined by the protocol.
25-
CodeRequestCancelled ErrorCode = -32800
26-
CodeContentModified ErrorCode = -32801
25+
CodeRequestCancelled Code = -32800
26+
CodeContentModified Code = -32801
2727
)
2828

2929
// Error
3030
type Error struct {
3131

3232
// Code a number indicating the error type that occurred.
33-
Code ErrorCode `json:"code"`
33+
Code Code `json:"code"`
3434

3535
// Data a Primitive or Structured value that contains additional
3636
// information about the error. Can be omitted.
@@ -49,7 +49,7 @@ func (e *Error) Error() string {
4949

5050
// Errorf builds a Error struct for the suppied message and code.
5151
// If args is not empty, message and args will be passed to Sprintf.
52-
func Errorf(code ErrorCode, format string, args ...interface{}) *Error {
52+
func Errorf(code Code, format string, args ...interface{}) *Error {
5353
return &Error{
5454
Code: code,
5555
Message: fmt.Sprintf(format, args...),

0 commit comments

Comments
 (0)