package magna import ( "fmt" ) // BufferOverflowError represents an error when there is a buffer overflow. type BufferOverflowError struct { Length int Offset int } func (e *BufferOverflowError) Error() string { return fmt.Sprintf("magna: offset %d is past the buffer length %d", e.Offset, e.Length) } // InvalidLabelError represents an error when an invalid label length is encountered. type InvalidLabelError struct { Length int } func (e *InvalidLabelError) Error() string { return fmt.Sprintf("magna: received invalid label length %d", e.Length) } // DomainCompressionError represents an error related to domain compression. type DomainCompressionError struct{} func (e *DomainCompressionError) Error() string { return "magna: loop detected in domain compression" } // MagnaError represents a generic error with a custom message. type MagnaError struct { Message string } func (e *MagnaError) Error() string { return fmt.Sprintf("magna: %s", e.Message) }