github.com/aavshr/aws-sdk-go@v1.41.3/service/dynamodb/expression/error.go (about)

     1  package expression
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  // InvalidParameterError is returned if invalid parameters are encountered. This
     8  // error specifically refers to situations where parameters are non-empty but
     9  // have an invalid syntax/format. The error message includes the function
    10  // that returned the error originally and the parameter type that was deemed
    11  // invalid.
    12  //
    13  // Example:
    14  //
    15  //     // err is of type InvalidParameterError
    16  //     _, err := expression.Name("foo..bar").BuildOperand()
    17  type InvalidParameterError struct {
    18  	parameterType string
    19  	functionName  string
    20  }
    21  
    22  func (ipe InvalidParameterError) Error() string {
    23  	return fmt.Sprintf("%s error: invalid parameter: %s", ipe.functionName, ipe.parameterType)
    24  }
    25  
    26  func newInvalidParameterError(funcName, paramType string) InvalidParameterError {
    27  	return InvalidParameterError{
    28  		parameterType: paramType,
    29  		functionName:  funcName,
    30  	}
    31  }
    32  
    33  // UnsetParameterError is returned if parameters are empty and uninitialized.
    34  // This error is returned if opaque structs (ConditionBuilder, NameBuilder,
    35  // Builder, etc) are initialized outside of functions in the package, since all
    36  // structs in the package are designed to be initialized with functions.
    37  //
    38  // Example:
    39  //
    40  //     // err is of type UnsetParameterError
    41  //     _, err := expression.Builder{}.Build()
    42  //     _, err := expression.NewBuilder().
    43  //                 WithCondition(expression.ConditionBuilder{}).
    44  //                 Build()
    45  type UnsetParameterError struct {
    46  	parameterType string
    47  	functionName  string
    48  }
    49  
    50  func (upe UnsetParameterError) Error() string {
    51  	return fmt.Sprintf("%s error: unset parameter: %s", upe.functionName, upe.parameterType)
    52  }
    53  
    54  func newUnsetParameterError(funcName, paramType string) UnsetParameterError {
    55  	return UnsetParameterError{
    56  		parameterType: paramType,
    57  		functionName:  funcName,
    58  	}
    59  }