ax(ueps): rename uepsError to sentinelError — redundant package prefix on private type
The type name uepsError used the package abbreviation as a prefix, which adds no semantic value inside the ueps package and violates AX Principle 1 (predictable names over short names). sentinelError names what the type IS: an immutable, comparable error value. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
ca3faa0144
commit
222edcd070
2 changed files with 5 additions and 5 deletions
|
|
@ -10,11 +10,11 @@ import (
|
|||
|
||||
// writeTLV(buffer, TagPayload, oversized) → errTLVValueTooLarge
|
||||
// if err == errTLVValueTooLarge { /* value exceeded 255-byte TLV length limit */ }
|
||||
var errTLVValueTooLarge = uepsError("TLV value too large for 1-byte length header")
|
||||
var errTLVValueTooLarge = sentinelError("TLV value too large for 1-byte length header")
|
||||
|
||||
type uepsError string
|
||||
type sentinelError string
|
||||
|
||||
func (uepsErrorValue uepsError) Error() string { return string(uepsErrorValue) }
|
||||
func (sentinelErrorValue sentinelError) Error() string { return string(sentinelErrorValue) }
|
||||
|
||||
// writeTLV(buffer, TagVersion, []byte{0x09}); writeTLV(buffer, TagHMAC, hmacSignature); buffer.WriteByte(TagPayload)
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ import (
|
|||
|
||||
// packet, err := ReadAndVerify(bufio.NewReader(conn), secret)
|
||||
// if err == errMissingHMAC { /* no HMAC tag found in frame */ }
|
||||
var errMissingHMAC = uepsError("UEPS packet missing HMAC signature")
|
||||
var errMissingHMAC = sentinelError("UEPS packet missing HMAC signature")
|
||||
|
||||
// packet, err := ReadAndVerify(bufio.NewReader(conn), wrongSecret)
|
||||
// if err == errIntegrityViolation { header.ThreatScore += 100; /* reject packet */ }
|
||||
var errIntegrityViolation = uepsError("integrity violation: HMAC mismatch")
|
||||
var errIntegrityViolation = sentinelError("integrity violation: HMAC mismatch")
|
||||
|
||||
// dispatch(packet.Header.IntentID, packet.Header.ThreatScore, packet.Payload)
|
||||
type ParsedPacket struct {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue