Skip to content

Commit fe20dd5

Browse files
authored
Merge pull request #750 from SumoLogic/erikatsumo-better-error
Improve error message when an API URL is constructed with missing parameters
2 parents 58fd279 + ef27ead commit fe20dd5

File tree

79 files changed

+166
-262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+166
-262
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## X.Y.Z (Unreleased)
22
* Add new change notes here
33

4+
ENHANCEMENTS:
5+
* Improve error message when an API URL is constructed with missing parameters
6+
47
## 3.0.8 (April 1, 2025)
58

69
BUG FIXES:

sumologic/data_source_sumologic_folder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func dataSourceSumologicFolderRead(d *schema.ResourceData, meta interface{}) err
4444
}
4545

4646
func (s *Client) GetFolderByPath(path string) (*Folder, error) {
47-
data, _, err := s.Get(fmt.Sprintf("v2/content/path?path=%s", url.QueryEscape(path)))
47+
data, err := s.Get(fmt.Sprintf("v2/content/path?path=%s", url.QueryEscape(path)))
4848
if err != nil {
4949
return nil, err
5050
}

sumologic/data_source_sumologic_role.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func dataSourceSumologicRoleRead(d *schema.ResourceData, meta interface{}) error
8686
}
8787

8888
func (s *Client) GetRoleName(name string) (*Role, error) {
89-
data, _, err := s.Get(fmt.Sprintf("v1/roles?name=%s", url.QueryEscape(name)))
89+
data, err := s.Get(fmt.Sprintf("v1/roles?name=%s", url.QueryEscape(name)))
9090
if err != nil {
9191
return nil, err
9292
}

sumologic/data_source_sumologic_role_v2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func dataSourceSumologicRoleV2Read(d *schema.ResourceData, meta interface{}) err
121121
}
122122

123123
func (s *Client) GetRoleNameV2(name string) (*RoleV2, error) {
124-
data, _, err := s.Get(fmt.Sprintf("v2/roles?name=%s", url.QueryEscape(name)))
124+
data, err := s.Get(fmt.Sprintf("v2/roles?name=%s", url.QueryEscape(name)))
125125
if err != nil {
126126
return nil, err
127127
}

sumologic/data_source_sumologic_user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func dataSourceSumologicUserRead(d *schema.ResourceData, meta interface{}) error
9191
}
9292

9393
func (s *Client) GetUserByEmail(email string) (*User, error) {
94-
data, _, err := s.Get(fmt.Sprintf("v1/users?email=%s", url.QueryEscape(email)))
94+
data, err := s.Get(fmt.Sprintf("v1/users?email=%s", url.QueryEscape(email)))
9595
if err != nil {
9696
return nil, err
9797
}

sumologic/resource_sumologic_monitors_library_monitor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ func exampleSloBurnRateMonitor(testName string) string {
15041504
}
15051505

15061506
func exampleLogsAnomalyMonitor(testName string) string {
1507-
query := "_sourceCategory=api error | timeslice 5m | count by _sourceHost"
1507+
query := "_sourceCategory=api error | timeslice 5m | count by _timeslice"
15081508
return exampleMonitorWithTriggerCondition(
15091509
testName,
15101510
"Logs",

sumologic/sumologic_app.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func (s *Client) GetAppInstance(id string) (*AppInstance, error) {
1111
url := fmt.Sprintf("v2/apps/instances/%s", id)
12-
data, _, err := s.Get(url)
12+
data, err := s.Get(url)
1313
if err != nil {
1414
return nil, err
1515
}
@@ -47,7 +47,7 @@ func (s *Client) CreateAppInstance(uuid string, appInstallPayload AppInstallPayl
4747
}
4848

4949
var appInstallResponse AppInstallResponse
50-
b, _, _ := s.Get(url)
50+
b, _ := s.Get(url)
5151
err = json.Unmarshal(b, &appInstallResponse)
5252
if err != nil {
5353
return "", err
@@ -96,7 +96,7 @@ func (s *Client) UpdateAppInstance(uuid string, appInstallPayload AppInstallPayl
9696
}
9797

9898
var appInstallResponse AppInstallResponse
99-
b, _, _ := s.Get(url)
99+
b, _ := s.Get(url)
100100
err = json.Unmarshal(b, &appInstallResponse)
101101
if err != nil {
102102
return "", err

0 commit comments

Comments
 (0)