Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check v.Errors length to avoid panic #21

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions service/cip/api_access_key_CreateAccessKey.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ func (a *APIClient) CreateAccessKey(body types.AccessKeyCreateRequest) (types.Ac
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_access_key_DeleteAccessKey.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ func (a *APIClient) DeleteAccessKey(id string) (*http.Response, error) {
newErr.error = err.Error()
return localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_access_key_ListAccessKeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ func (a *APIClient) ListAccessKeys(localVarOptionals *types.AccessKeyOpts) (type
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_access_key_ListPersonalAccessKeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ func (a *APIClient) ListPersonalAccessKeys() (types.ListAccessKeysResult, *http.
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_access_key_UpdateAccessKey.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ func (a *APIClient) UpdateAccessKey(body types.AccessKeyUpdateRequest, id string
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_account_CreateSubdomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ func (a *APIClient) CreateSubdomain(body types.ConfigureSubdomainRequest) (types
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_account_DeleteSubdomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ func (a *APIClient) DeleteSubdomain() (*http.Response, error) {
newErr.error = err.Error()
return localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_account_GetAccountOwner.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ func (a *APIClient) GetAccountOwner() (string, *http.Response, error) {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_account_GetStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ func (a *APIClient) GetStatus() (types.AccountStatusResponse, *http.Response, er
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_account_GetSubdomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ func (a *APIClient) GetSubdomain() (types.SubdomainDefinitionResponse, *http.Res
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_account_RecoverSubdomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ func (a *APIClient) RecoverSubdomains(email string) (*http.Response, error) {
newErr.error = err.Error()
return localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_account_UpdateSubdomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ func (a *APIClient) UpdateSubdomain(body types.ConfigureSubdomainRequest) (types
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_app_GetApp.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ func (a *APIClient) GetApp(uuid string) (types.App, *http.Response, error) {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_app_GetAsyncInstallStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ func (a *APIClient) GetAsyncInstallStatus(jobId string) (types.AsyncJobStatus, *
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_app_InstallApp.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ func (a *APIClient) InstallApp(body types.AppInstallRequest, uuid string) (types
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_app_ListApps.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ func (a *APIClient) ListApps() (types.ListAppsResult, *http.Response, error) {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_archive_CreateArchiveJob.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ func (a *APIClient) CreateArchiveJob(body types.CreateArchiveJobRequest, sourceI
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_archive_DeleteArchiveJob.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ func (a *APIClient) DeleteArchiveJob(sourceId string, id string) (*http.Response
newErr.error = err.Error()
return localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_archive_ListArchiveJobsBySourceId.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ func (a *APIClient) ListArchiveJobsBySourceId(sourceId string, localVarOptionals
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_archive_ListArchiveJobsCountPerSource.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ func (a *APIClient) ListArchiveJobsCountPerSource() (types.ListArchiveJobsCount,
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_connection_CreateServiceNowConnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ func (a *APIClient) CreateServiceNowConnection(body types.ServiceNowDefinition)
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_connection_CreateWebhookConnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ func (a *APIClient) CreateWebhookConnection(body types.WebhookDefinition) (types
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarReturnValue, localVarHttpResponse, newErr
}
Expand Down
10 changes: 6 additions & 4 deletions service/cip/api_connection_DeleteConnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ func (a *APIClient) DeleteConnection(id string, type_ string) (*http.Response, e
newErr.error = err.Error()
return localVarHttpResponse, newErr
}
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
if len(v.Errors) > 0 {
if v.Errors[0].Meta.Reason != "" {
newErr.error = v.Errors[0].Message + ": " + v.Errors[0].Meta.Reason
} else {
newErr.error = v.Errors[0].Message
}
}
return localVarHttpResponse, newErr
}
Expand Down
Loading