Skip to content

Commit

Permalink
fix exception test
Browse files Browse the repository at this point in the history
more sophisticated fetching opt value
  • Loading branch information
kosyloa committed Apr 18, 2024
1 parent ff48333 commit 826b75d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion DXFeedFramework/Native/Graal/Isolate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
6 changes: 4 additions & 2 deletions DXFeedFramework/Utils/Optional+Ext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 826b75d

Please sign in to comment.