Struct: request.ErrInvalidParams

import "../ibm-cos-sdk-go/aws/request"

Overview

An ErrInvalidParams provides wrapping of invalid parameter errors found when validating API operation input parameters.

Implemented Interfaces

awserr.BatchError, awserr.BatchedErrors, s3crypto.Cipher, awserr.Error, s3manager.ReadSeekerWriteTo, s3manager.WriterReadFrom

Structure Field Summary collapse

Method Summary collapse

Structure Field Details

Context string

Context is the base context of the invalid parameter group.

Method Details

func (e *ErrInvalidParams) Add(err ErrInvalidParam)

Add adds a new invalid parameter error to the collection of invalid parameters. The context of the invalid parameter will be updated to reflect this collection.



45
46
47
48
// File 'aws/request/validation.go', line 45

func (e *ErrInvalidParams) Add(err ErrInvalidParam) { err.SetContext(e.Context) e.errs = append(e.errs, err) }

func (e *ErrInvalidParams) AddNested(nestedCtx string, nested ErrInvalidParams)

AddNested adds the invalid parameter errors from another ErrInvalidParams value into this collection. The nested errors will have their nested context updated and base context to reflect the merging.

Use for nested validations errors.



55
56
57
58
59
60
61
// File 'aws/request/validation.go', line 55

func (e *ErrInvalidParams) AddNested(nestedCtx string, nested ErrInvalidParams) { for _, err := range nested.errs { err.SetContext(e.Context) err.AddNestedContext(nestedCtx) e.errs = append(e.errs, err) } }

func (e ErrInvalidParams) Code() string

Code returns the code of the error



69
70
71
// File 'aws/request/validation.go', line 69

func (e ErrInvalidParams) Code() string { return InvalidParameterErrCode }

func (e ErrInvalidParams) Error() string

Error returns the string formatted form of the invalid parameters.



79
80
81
82
83
84
85
86
87
88
// File 'aws/request/validation.go', line 79

func (e ErrInvalidParams) Error() string { w := &bytes.Buffer{} fmt.Fprintf(w, "%s: %s\n", e.Code(), e.Message()) for _, err := range e.errs { fmt.Fprintf(w, "- %s\n", err.Message()) } return w.String() }

func (e ErrInvalidParams) Len() int

Len returns the number of invalid parameter errors



64
65
66
// File 'aws/request/validation.go', line 64

func (e ErrInvalidParams) Len() int { return len(e.errs) }

func (e ErrInvalidParams) Message() string

Message returns the message of the error



74
75
76
// File 'aws/request/validation.go', line 74

func (e ErrInvalidParams) Message() string { return fmt.Sprintf("%d validation error(s) found.", len(e.errs)) }

func (e ErrInvalidParams) OrigErr() error

OrigErr returns the invalid parameters as a awserr.BatchedErrors value



91
92
93
94
// File 'aws/request/validation.go', line 91

func (e ErrInvalidParams) OrigErr() error { return awserr.NewBatchError( InvalidParameterErrCode, e.Message(), e.OrigErrs()) }

func (e ErrInvalidParams) OrigErrs() []error

OrigErrs returns a slice of the invalid parameters



97
98
99
100
101
102
103
104
// File 'aws/request/validation.go', line 97

func (e ErrInvalidParams) OrigErrs() []error { errs := make([]error, len(e.errs)) for i := 0; i < len(errs); i++ { errs[i] = e.errs[i] } return errs }