mirror of
https://github.com/soypat/lneto.git
synced 2026-08-14 03:43:45 +00:00
Error rewrites (#43)
* pcap: reuse Frame memory * slog: reduce heap allocations of addresses; also prevent heap alloc of dhcp options in pcap * dns: heapless improvement; add StackAsync buffer for more heapless operation; start thinking of errors * errors: begin standardise errors in lneto * errors: finish standardization of errors * fix merge issues * add more lneto errors to rest of package * format errors.go
This commit is contained in:
@@ -1,30 +1,25 @@
|
||||
package lneto
|
||||
|
||||
// type ErrorPacketDrop struct {
|
||||
// Message string
|
||||
// }
|
||||
|
||||
// var genericErrPacketDrop = &ErrorPacketDrop{Message: ErrPacketDrop.Error()}
|
||||
|
||||
// // ErrGenericPacketDrop returns the generic packet drop error. It performs no allocations.
|
||||
// func ErrGenericPacketDrop() error {
|
||||
// return genericErrPacketDrop
|
||||
// }
|
||||
|
||||
// func (err *ErrorPacketDrop) Error() string {
|
||||
// return err.Message
|
||||
// }
|
||||
|
||||
type errGeneric uint8
|
||||
|
||||
// Generic errors common to internet functioning.
|
||||
const (
|
||||
_ errGeneric = iota // non-initialized err
|
||||
ErrBug // lneto-bug(use build tag "debugheaplog")
|
||||
ErrPacketDrop // packet dropped
|
||||
ErrBadCRC // incorrect checksum
|
||||
ErrZeroSource // zero source(port/addr)
|
||||
ErrZeroDestination // zero destination(port/addr)
|
||||
_ errGeneric = iota // non-initialized err
|
||||
ErrBug // lneto-bug(use build tag "debugheaplog")
|
||||
ErrPacketDrop // packet dropped
|
||||
ErrBadCRC // incorrect checksum
|
||||
ErrZeroSource // zero source(port/addr)
|
||||
ErrZeroDestination // zero destination(port/addr)
|
||||
ErrShortBuffer // short buffer
|
||||
ErrBufferFull // buffer full
|
||||
ErrInvalidAddr // invalid address
|
||||
ErrUnsupported // unsupported
|
||||
ErrMismatch // mismatch
|
||||
ErrMismatchLen // mismatched length
|
||||
ErrInvalidConfig // invalid configuration
|
||||
ErrInvalidField // invalid field
|
||||
ErrInvalidLengthField // invalid length field
|
||||
ErrExhausted // resource exhausted
|
||||
)
|
||||
|
||||
func (err errGeneric) Error() string {
|
||||
|
||||
Reference in New Issue
Block a user