// SetLastErrorCode sets the LastErrorCode field's value.
191036
func (s *ConfigStreamDeliveryInfo) SetLastErrorCode(v string) *ConfigStreamDeliveryInfo {
	s.LastErrorCode = &v
	return s
}
957623
func (s *RecordError) SetCode(v string) *RecordError {
	s.Code = &v
	return s
}
76641
func (s *UnprocessedQueryExecutionId) SetErrorCode(v string) *UnprocessedQueryExecutionId {
	s.ErrorCode = &v
	return s
}
74716
func (s *CustomErrorResponse) SetErrorCode(v int64) *CustomErrorResponse {
	s.ErrorCode = &v
	return s
}
349136
func (s *Diagnostics) SetErrorCode(v string) *Diagnostics {
	s.ErrorCode = &v
	return s
}
945196
func (s *AuditCheckDetails) SetErrorCode(v string) *AuditCheckDetails {
	s.ErrorCode = &v
	return s
}
644706
func (s *CustomKeyStoresListEntry) SetConnectionErrorCode(v string) *CustomKeyStoresListEntry {
	s.ConnectionErrorCode = &v
	return s
}
1281179
func (s *Error) SetErrorCode(v string) *Error {
	s.ErrorCode = &v
	return s
}
260530
func (s *PutEventsResultEntry) SetErrorCode(v string) *PutEventsResultEntry {
	s.ErrorCode = &v
	return s
}
57
func (r *Rets) SetErrorCode() string {
	const code = `if r0 != 0 {
		%s = %sErrno(r0)
	}`
	if r.Name == "" && !r.ReturnsError {
		return ""
	}
	if r.Name == "" {
		return r.useLongHandleErrorCode("r1")
	}
	if r.Type == "error" {
		return fmt.Sprintf(code, r.Name, syscalldot())
	}
	s := ""
	switch {
	case r.Type[0] == '*':
		s = fmt.Sprintf("%s = (%s)(unsafe.Pointer(r0))", r.Name, r.Type)
	case r.Type == "bool":
		s = fmt.Sprintf("%s = r0 != 0", r.Name)
	default:
		s = fmt.Sprintf("%s = %s(r0)", r.Name, r.Type)
	}
	if !r.ReturnsError {
		return s
	}
	return s + "\n\t" + r.useLongHandleErrorCode(r.Name)
}
1342110
func (s *FailedWorkspaceChangeRequest) SetErrorCode(v string) *FailedWorkspaceChangeRequest {
	s.ErrorCode = &v
	return s
}
314340
func (s *DescribeVaultOutput) SetLastInventoryDate(v string) *DescribeVaultOutput {
	s.LastInventoryDate = &v
	return s
}
313881
func (s *StackError) SetErrorCode(v string) *StackError {
	s.ErrorCode = &v
	return s
}
442390
func (s *TaskExecutionResultDetail) SetErrorDetail(v string) *TaskExecutionResultDetail {
	s.ErrorDetail = &v
	return s
}
371183
func (s *ConfigExportDeliveryInfo) SetLastErrorMessage(v string) *ConfigExportDeliveryInfo {
	s.LastErrorMessage = &v
	return s
}
602520
func (s *FailedServiceActionAssociation) SetErrorCode(v string) *FailedServiceActionAssociation {
	s.ErrorCode = &v
	return s
}
954053
func (s *Status) SetError(err error) {

	if err == nil {
		s.Code = ""
		s.Message = ""
		s.Errors = nil
		return
	}

	cause := errors.Cause(err)

	if astErr, ok := cause.(ast.Errors); ok {
		s.Code = errCode
		s.Message = types.MsgCompileModuleError
		s.Errors = make([]error, len(astErr))
		for i := range astErr {
			s.Errors[i] = astErr[i]
		}
	} else {
		s.Code = errCode
		s.Message = err.Error()
		s.Errors = nil
	}
}