Skip to content

Commit 9ba9409

Browse files
authored
fix for ODP INVALID_IDENTIFIER_EXCEPTION code (#488)
1 parent 7a52c97 commit 9ba9409

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Sources/ODP/OdpSegmentApiManager.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ import Foundation
8585
"customer"
8686
],
8787
"extensions": {
88-
"classification": "InvalidIdentifierException"
88+
"code": "INVALID_IDENTIFIER_EXCEPTION",
89+
"classification": "DataFetchingException"
8990
}
9091
}
9192
],
@@ -162,7 +163,7 @@ open class OdpSegmentApiManager {
162163
// most meaningful ODP errors are returned in 200 success JSON under {"errors": ...}
163164
if let odpErrors: [[String: Any]] = dict.extractComponent(keyPath: "errors") {
164165
if let odpError = odpErrors.first, let errorClass: String = odpError.extractComponent(keyPath: "extensions.classification") {
165-
if errorClass == "InvalidIdentifierException" {
166+
if let errorCode: String = odpError.extractComponent(keyPath: "extensions.code"), errorCode == "INVALID_IDENTIFIER_EXCEPTION" {
166167
returnError = .invalidSegmentIdentifier
167168
} else {
168169
returnError = .fetchSegmentsFailed(errorClass)

Tests/OptimizelyTests-Common/OdpSegmentApiManagerTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ extension OdpSegmentApiManagerTests {
435435
"customer"
436436
],
437437
"extensions": {
438-
"classification": "InvalidIdentifierException"
438+
"code": "INVALID_IDENTIFIER_EXCEPTION",
439+
"classification": "DataFetchingException"
439440
}
440441
}
441442
],

0 commit comments

Comments
 (0)