ax(node): rename pe to protocolError in GetProtocolErrorCode
AX Principle 1: pe is an abbreviation requiring a comment to explain. Renamed to protocolError throughout, including the usage example comment. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
4638a34ffa
commit
cdeb66b82d
1 changed files with 3 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
// if pe, ok := err.(*ProtocolError); ok { log(pe.Code, pe.Message) }
|
||||
// if protocolError, ok := err.(*ProtocolError); ok { log(protocolError.Code, protocolError.Message) }
|
||||
type ProtocolError struct {
|
||||
Code int
|
||||
Message string
|
||||
|
|
@ -79,8 +79,8 @@ func IsProtocolError(err error) bool {
|
|||
|
||||
// code := GetProtocolErrorCode(err) // 0 when err is not a ProtocolError
|
||||
func GetProtocolErrorCode(err error) int {
|
||||
if pe, ok := err.(*ProtocolError); ok {
|
||||
return pe.Code
|
||||
if protocolError, ok := err.(*ProtocolError); ok {
|
||||
return protocolError.Code
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue