github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/tcp/errors.go (about)

     1  /* For license and copyright information please see the LEGAL file in the code repository */
     2  
     3  package tcp
     4  
     5  import (
     6  	er "github.com/GeniusesGroup/libgo/error"
     7  	"github.com/GeniusesGroup/libgo/protocol"
     8  )
     9  
    10  const domainEnglish = "TCP"
    11  const domainPersian = "TCP"
    12  
    13  // Errors
    14  var (
    15  	ErrPacketTooShort    er.Error
    16  	ErrPacketWrongLength er.Error
    17  )
    18  
    19  func init() {
    20  	ErrPacketTooShort.Init("domain/tcp.protocol; type=error; name=packet-too-short")
    21  	ErrPacketTooShort.SetDetail(protocol.LanguageEnglish, domainEnglish,
    22  		"Packet Too Short",
    23  		"TCP packet is empty or too short than standard header. It must include at least 20Byte header",
    24  		"",
    25  		"",
    26  		nil)
    27  
    28  	ErrPacketWrongLength.Init("domain/tcp.protocol; type=error; name=packet-wrong-length")
    29  	ErrPacketTooShort.SetDetail(protocol.LanguageEnglish, domainEnglish,
    30  		"Packet Wrong Length",
    31  		"Data offset set in TCP packet header is not set correctly",
    32  		"",
    33  		"",
    34  		nil)
    35  }