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

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package pehrest
     4  
     5  import (
     6  	er "../error"
     7  	"../protocol"
     8  )
     9  
    10  const domainEnglish = "Index"
    11  const domainPersian = "پهرست"
    12  
    13  // Errors
    14  var (
    15  	ErrRecordNil              er.Error
    16  	ErrRecordNotValid         er.Error
    17  	ErrRecordNotExist         er.Error
    18  	ErrRecordManipulated      er.Error
    19  	ErrIndexValueAlreadyExist er.Error
    20  )
    21  
    22  func init() {
    23  	ErrRecordNil.Init("urn:giti:index.protocol:error:record-nil")
    24  	ErrRecordNil.SetDetail(protocol.LanguageEnglish, domainEnglish, "Record Nil",
    25  		"Given record can't be nil",
    26  		"",
    27  		"",
    28  		nil)
    29  
    30  	ErrRecordNotValid.Init("urn:giti:index.protocol:error:record-not-valid")
    31  	ErrRecordNotValid.SetDetail(protocol.LanguageEnglish, domainEnglish, "Record Not Valid",
    32  		"Given recordID exist in storage devices but has diffrent StructureID",
    33  		"",
    34  		"",
    35  		nil)
    36  
    37  	ErrRecordNotExist.Init("urn:giti:index.protocol:error:record-not-exist")
    38  	ErrRecordNotExist.SetDetail(protocol.LanguageEnglish, domainEnglish, "Record Not Exist",
    39  		"Given recordID not exist in any storage devices",
    40  		"",
    41  		"",
    42  		nil)
    43  
    44  	ErrRecordManipulated.Init("urn:giti:index.protocol:error:record-manipulated")
    45  	ErrRecordManipulated.SetDetail(protocol.LanguageEnglish, domainEnglish, "Record Manipulated",
    46  		"Index record has problem when engine try to read it from storage devices",
    47  		"",
    48  		"",
    49  		nil)
    50  
    51  	ErrIndexValueAlreadyExist.Init("urn:giti:index.protocol:error:index-value-already-exist")
    52  	ErrIndexValueAlreadyExist.SetDetail(protocol.LanguageEnglish, domainEnglish, "Index Value Already Exist",
    53  		"",
    54  		"",
    55  		"",
    56  		nil)
    57  }