diff --git a/DXFeedFramework/Native/Graal/Isolate.swift b/DXFeedFramework/Native/Graal/Isolate.swift index 9f224897d..66ae6ace0 100644 --- a/DXFeedFramework/Native/Graal/Isolate.swift +++ b/DXFeedFramework/Native/Graal/Isolate.swift @@ -100,6 +100,7 @@ class Isolate { func throwException() throws { let thread = currentThread() - _ = try ErrorCheck.nativeCall(thread, dxfg_throw_exception(thread)) + _ = try ErrorCheck.nativeCall(thread, dxfg_get_and_clear_thread_exception_t(thread)) // to init com.dxfeed.sdk.NativeUtils + _ = try ErrorCheck.nativeCall(thread, dxfg_throw_exception(thread)) } } diff --git a/DXFeedFramework/Utils/Optional+Ext.swift b/DXFeedFramework/Utils/Optional+Ext.swift index 11a6f7151..a24e6b75c 100644 --- a/DXFeedFramework/Utils/Optional+Ext.swift +++ b/DXFeedFramework/Utils/Optional+Ext.swift @@ -9,9 +9,11 @@ import Foundation extension Optional { func value() throws -> Wrapped { - guard let value = self else { + switch self { + case .none: throw GraalException.nullException + case .some(let val): + return val } - return value } }