github.com/aavshr/aws-sdk-go@v1.41.3/internal/ini/parse_error.go (about)

     1  package ini
     2  
     3  import "fmt"
     4  
     5  const (
     6  	// ErrCodeParseError is returned when a parsing error
     7  	// has occurred.
     8  	ErrCodeParseError = "INIParseError"
     9  )
    10  
    11  // ParseError is an error which is returned during any part of
    12  // the parsing process.
    13  type ParseError struct {
    14  	msg string
    15  }
    16  
    17  // NewParseError will return a new ParseError where message
    18  // is the description of the error.
    19  func NewParseError(message string) *ParseError {
    20  	return &ParseError{
    21  		msg: message,
    22  	}
    23  }
    24  
    25  // Code will return the ErrCodeParseError
    26  func (err *ParseError) Code() string {
    27  	return ErrCodeParseError
    28  }
    29  
    30  // Message returns the error's message
    31  func (err *ParseError) Message() string {
    32  	return err.msg
    33  }
    34  
    35  // OrigError return nothing since there will never be any
    36  // original error.
    37  func (err *ParseError) OrigError() error {
    38  	return nil
    39  }
    40  
    41  func (err *ParseError) Error() string {
    42  	return fmt.Sprintf("%s: %s", err.Code(), err.Message())
    43  }