Skip to content

Commit 16533b7

Browse files
authored
[FSSDK-9131] fix for ODP INVALID_IDENTIFIER_EXCEPTION code (#372)
1 parent 578974b commit 16533b7

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pkg/odp/segment/segment_api_manager.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2022, Optimizely, Inc. and contributors *
2+
* Copyright 2022-2023, Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -108,7 +108,8 @@ type APIManager interface {
108108
"customer"
109109
],
110110
"extensions": {
111-
"classification": "InvalidIdentifierException"
111+
"code": "INVALID_IDENTIFIER_EXCEPTION",
112+
"classification": "DataFetchingException"
112113
}
113114
}
114115
],
@@ -160,7 +161,7 @@ func (sm *DefaultSegmentAPIManager) FetchQualifiedSegments(apiKey, apiHost, user
160161
if odpErrors, ok := sm.extractComponent("errors", responseMap).([]interface{}); ok {
161162
if odpError, ok := odpErrors[0].(map[string]interface{}); ok {
162163
if errorClass, ok := sm.extractComponent("extensions.classification", odpError).(string); ok {
163-
if errorClass == "InvalidIdentifierException" {
164+
if errorCode, ok := sm.extractComponent("extensions.code", odpError).(string); ok && errorCode == "INVALID_IDENTIFIER_EXCEPTION" {
164165
return nil, errors.New(utils.InvalidSegmentIdentifier)
165166
}
166167
return nil, fmt.Errorf(utils.FetchSegmentsFailedError, errorClass)

pkg/odp/segment/segment_api_manager_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2022, Optimizely, Inc. and contributors *
2+
* Copyright 2022-2023, Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -98,7 +98,8 @@ func (s *SegmentAPIManagerTestSuite) SetupTest() {
9898
"customer"
9999
],
100100
"extensions": {
101-
"classification": "InvalidIdentifierException"
101+
"code": "INVALID_IDENTIFIER_EXCEPTION",
102+
"classification": "DataFetchingException"
102103
}
103104
}
104105
],

0 commit comments

Comments
 (0)