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

     1  /* For license and copyright information please see the LEGAL file in the code repository */
     2  
     3  package hs
     4  
     5  import (
     6  	er "github.com/GeniusesGroup/libgo/error"
     7  	"github.com/GeniusesGroup/libgo/protocol"
     8  )
     9  
    10  const domainEnglish = "HTTP"
    11  const domainPersian = "HTTP"
    12  
    13  // Declare package errors
    14  var (
    15  	ErrNoConnection         er.Error
    16  	ErrNotFound             er.Error
    17  	ErrUnsupportedMediaType er.Error
    18  )
    19  
    20  func init() {
    21  	ErrNoConnection.Init("domain/http.protocol; type=error; name=no-connection")
    22  	ErrNoConnection.SetDetail(protocol.LanguageEnglish, domainEnglish,
    23  		"No Connection",
    24  		"There is no connection to peer(server or client) to process request",
    25  		"",
    26  		"",
    27  		nil)
    28  	ErrNoConnection.SetDetail(protocol.LanguagePersian, domainPersian,
    29  		"عدم وجود ارتباط",
    30  		"هیچ راه ارتباطی با رایانه مقصد برای پردازش درخواست مورد نظر وجود ندارد",
    31  		"",
    32  		"",
    33  		nil)
    34  
    35  	ErrNotFound.Init("domain/http.protocol; type=error; name=not-found")
    36  	ErrNotFound.SetDetail(protocol.LanguageEnglish, domainEnglish,
    37  		"Not Found",
    38  		"Requested HTTP URI Service is not found in this instance of app",
    39  		"",
    40  		"",
    41  		nil)
    42  
    43  	ErrUnsupportedMediaType.Init("domain/http.protocol; type=error; name=unsupported-media-type")
    44  	ErrUnsupportedMediaType.SetDetail(protocol.LanguageEnglish, domainEnglish,
    45  		"Unsupported Media Type",
    46  		"Refuse to accept the request or response because the payload format or encoding is in an unsupported format",
    47  		"",
    48  		"",
    49  		nil)
    50  }