You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that RiakException constructor doesn't expose the sub-types of exceptions. There is really no good way to do a user-friendly error handling if we don't know what sub-type of exception this is. For example, given TypeException, I could tell the user that the requested data doesn't exist. NetException on the other hand is some kind of outage message in my case. This is very, very useful, and so, will really appreciate exposing the constructors. This is my current exception handling code - will like to be able to pattern match on RiakException and do appropriate error handling instead of using RiakException show:
procRiakException :: SomeException -> Maybe RiakException
procRiakException = fromException
procException :: SomeException -> (Int,T.Text)
procException e = case (procRiakException e) of
Just ex -> (2, T.pack . show $ ex)
Nothing -> (1, T.pack . displayException $ e)
The text was updated successfully, but these errors were encountered:
sanketr
changed the title
Exception handling in Riak
More specific exception handling in Riak
Jul 9, 2016
On further investigation, it seems that ErrorResponse is where the Riak exceptions are handled. It is defined as Exceptionelsewhere but not exported. So, probably this is the correct exception to look at for making visible to users of the library.
Folks,
It seems that
RiakException
constructor doesn't expose the sub-types of exceptions. There is really no good way to do a user-friendly error handling if we don't know what sub-type of exception this is. For example, givenTypeException
, I could tell the user that the requested data doesn't exist.NetException
on the other hand is some kind of outage message in my case. This is very, very useful, and so, will really appreciate exposing the constructors. This is my current exception handling code - will like to be able to pattern match on RiakException and do appropriate error handling instead of usingRiakException show
:The text was updated successfully, but these errors were encountered: