-
Notifications
You must be signed in to change notification settings - Fork 9
/
errors.go
58 lines (48 loc) · 2.06 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package sunrpc
import (
"errors"
"fmt"
)
// Internal errors
var (
ErrInvalidFragmentSize = errors.New("The RPC fragment size is invalid")
ErrRPCMessageSizeExceeded = errors.New("The RPC message size is too big")
)
// RPC errors
// ErrRPCMismatch contains the lowest and highest version of RPC protocol
// supported by the remote server
type ErrRPCMismatch struct {
Low uint32
High uint32
}
func (e ErrRPCMismatch) Error() string {
return fmt.Sprintf("RPC version not supported by server. Lowest and highest supported versions are %d and %d respectively", e.Low, e.High)
}
// ErrProgMismatch contains the lowest and highest version of program version
// supported by the remote program
type ErrProgMismatch struct {
Low uint32
High uint32
}
func (e ErrProgMismatch) Error() string {
return fmt.Sprintf("Program version not supported. Lowest and highest supported versions are %d and %d respectively", e.Low, e.High)
}
// Given that the remote server accepted the RPC call, following errors
// represent error status of an attempt to call remote procedure
var (
ErrProgUnavail = errors.New("Remote server has not exported program")
ErrProcUnavail = errors.New("Remote server has no such procedure")
ErrGarbageArgs = errors.New("Remote procedure cannot decode params")
ErrSystemErr = errors.New("System error on remote server")
)
// These errors represent invalid replies from server and auth rejection.
var (
ErrInvalidRPCMessageType = errors.New("Invalid RPC message type received")
ErrInvalidRPCRepyType = errors.New("Invalid RPC reply received. Reply type should be MsgAccepted or MsgDenied")
ErrInvalidMsgDeniedType = errors.New("Invalid MsgDenied reply. Possible values are RPCMismatch and AuthError")
ErrInvalidMsgAccepted = errors.New("Invalid MsgAccepted reply received")
ErrAuthError = errors.New("Remote server rejected identity of the caller")
)