Skip to content

Commit

Permalink
Network: rethrow IOException as NOnionException
Browse files Browse the repository at this point in the history
IOExcepion caused problem in geewallet as mentioned in [1]. This commit will fix this problem by catching the IOException and rethrowing it as NOnionException.

[1] #45
  • Loading branch information
parhamsaremi committed Nov 3, 2022
1 parent ade18d1 commit cee1e28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions NOnion/Exceptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@ type NOnionSocketException
"Got socket exception during data transfer",
innerException
)

type NOnionIOException internal (innerException: System.IO.IOException) =
inherit NOnionException
(
"Got IO exception during data transfer",
innerException
)
5 changes: 4 additions & 1 deletion NOnion/Network/TorGuard.fs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ type TorGuard private (client: TcpClient, sslStream: SslStream) =
match FSharpUtil.FindException<SocketException> exn with
| Some socketEx ->
return raise <| GuardConnectionFailedException socketEx
| None -> return raise <| FSharpUtil.ReRaise exn
| None ->
match FSharpUtil.FindException<IOException> exn with
| Some ioExp -> return raise <| NOnionIOException ioExp
| None -> return raise <| FSharpUtil.ReRaise exn

ipEndpoint.ToString()
|> sprintf "TorGuard: ssl connection to %s guard node authenticated"
Expand Down

0 comments on commit cee1e28

Please sign in to comment.