Skip to content

Commit

Permalink
Propagate exception from the C++ core
Browse files Browse the repository at this point in the history
  • Loading branch information
rigazilla committed Aug 8, 2018
1 parent 11b63e5 commit 759ef8d
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 108 deletions.
12 changes: 12 additions & 0 deletions src/Infinispan.HotRod/Exceptions/HotRodClientRollbackException.cs
@@ -0,0 +1,12 @@
namespace Infinispan.HotRod.Exceptions
{
/// <summary>
/// Used to indicated that a commit operation actually rolled back
/// </summary>
public class HotRodClientRollbackException : HotRodClientException
{
internal HotRodClientRollbackException(string message) : base(message)
{
}
}
}
13 changes: 10 additions & 3 deletions swig/hotrod_exception.i
Expand Up @@ -9,6 +9,7 @@
HotRod_HotRodClientException,
HotRod_CounterLowerBoundException,
HotRod_CounterUpperBoundException,
HotRod_HotRodClientRollbackException,
HotRod_Exception,

} HotRodExceptionCodes;
Expand Down Expand Up @@ -66,6 +67,9 @@
SWIGPendingException.Set(new Infinispan.HotRod.Exceptions.CounterUpperBoundException(message));
break;
case 9:
SWIGPendingException.Set(new Infinispan.HotRod.Exceptions.HotRodClientRollbackException(message));
break;
case 10:
default:
SWIGPendingException.Set(new Infinispan.HotRod.Exceptions.Exception(message));
break;
Expand Down Expand Up @@ -100,15 +104,18 @@
} catch (const infinispan::hotrod::UnsupportedOperationException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_UnsupportedOperationException, e.what());
return $null;
} catch (const infinispan::hotrod::HotRodClientException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_HotRodClientException, e.what());
return $null;
} catch (const infinispan::hotrod::CounterLowerBoundException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_CounterLowerBoundException, e.what());
return $null;
} catch (const infinispan::hotrod::CounterUpperBoundException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_CounterUpperBoundException, e.what());
return $null;
} catch (const infinispan::hotrod::HotRodClientRollbackException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_HotRodClientRollbackException, e.what());
return $null;
} catch (const infinispan::hotrod::HotRodClientException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_HotRodClientException, e.what());
return $null;
} catch (const infinispan::hotrod::Exception& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_Exception, e.what());
return $null;
Expand Down

0 comments on commit 759ef8d

Please sign in to comment.