-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(net): add custom exceptions (#718)
- Loading branch information
1 parent
b2a6cb1
commit a80cd16
Showing
7 changed files
with
67 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
net/src/Sails.Remoting/Exceptions/ExtrinsicDispatchException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using Substrate.Gear.Api.Generated.Model.frame_support.dispatch; | ||
using Substrate.Gear.Api.Generated.Model.sp_runtime; | ||
|
||
namespace Sails.Remoting.Exceptions; | ||
|
||
public class ExtrinsicDispatchException : SailsException | ||
{ | ||
public EnumDispatchError? DispatchError { get; } | ||
public DispatchInfo? DispatchInfo { get; } | ||
|
||
public ExtrinsicDispatchException(string message, ExtrinsicFailedEventData? eventData) : base(message) | ||
{ | ||
this.DispatchError = eventData?.Value[0] as EnumDispatchError; | ||
this.DispatchInfo = eventData?.Value[1] as DispatchInfo; | ||
} | ||
|
||
public ExtrinsicDispatchException(string message, EnumDispatchError? dispatchError, DispatchInfo? dispatchInfo) | ||
: base(message) | ||
{ | ||
this.DispatchError = dispatchError; | ||
this.DispatchInfo = dispatchInfo; | ||
} | ||
|
||
public ExtrinsicDispatchException() : base() | ||
{ | ||
} | ||
|
||
public ExtrinsicDispatchException(string message) : base(message) | ||
{ | ||
} | ||
|
||
public ExtrinsicDispatchException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
namespace Sails.Remoting.Exceptions; | ||
|
||
public class SailsException : Exception | ||
{ | ||
public SailsException() : base() | ||
{ | ||
} | ||
|
||
public SailsException(string message) : base(message) | ||
{ | ||
} | ||
|
||
public SailsException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters