...

Source file src/edge-infra.dev/pkg/lib/ini/error.go

Documentation: edge-infra.dev/pkg/lib/ini

     1  package ini
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  // ErrDelimiterNotFound indicates the error type of no delimiter is found which there should be one.
     8  type ErrDelimiterNotFound struct {
     9  	Line string
    10  }
    11  
    12  // IsErrDelimiterNotFound returns true if the given error is an instance of ErrDelimiterNotFound.
    13  func IsErrDelimiterNotFound(err error) bool {
    14  	_, ok := err.(ErrDelimiterNotFound)
    15  	return ok
    16  }
    17  
    18  func (err ErrDelimiterNotFound) Error() string {
    19  	return fmt.Sprintf("key-value delimiter not found: %s", err.Line)
    20  }
    21  
    22  // ErrEmptyKeyName indicates the error type of no key name is found which there should be one.
    23  type ErrEmptyKeyName struct {
    24  	Line string
    25  }
    26  
    27  // IsErrEmptyKeyName returns true if the given error is an instance of ErrEmptyKeyName.
    28  func IsErrEmptyKeyName(err error) bool {
    29  	_, ok := err.(ErrEmptyKeyName)
    30  	return ok
    31  }
    32  
    33  func (err ErrEmptyKeyName) Error() string {
    34  	return fmt.Sprintf("empty key name: %s", err.Line)
    35  }
    36  

View as plain text