-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from Concordium/better-ffi-error-handling
FFI error handling
- Loading branch information
Showing
17 changed files
with
412 additions
and
83 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
Submodule concordium-base
updated
187 files
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
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,23 @@ | ||
using System.Text; | ||
using Concordium.Sdk.Interop; | ||
|
||
namespace Concordium.Sdk.Exceptions; | ||
|
||
/// <summary> | ||
/// Thrown when a interop call failed with possible error as message. | ||
/// </summary> | ||
public sealed class SchemaJsonException : Exception | ||
{ | ||
private const string EmptyErrorMessage = "Empty error message returned"; | ||
/// <summary> | ||
/// Type of error | ||
/// </summary> | ||
public SchemaJsonResult SchemaJsonResult { get; } | ||
|
||
internal static SchemaJsonException Create(SchemaJsonResult schemaJsonResult, byte[]? message) => | ||
message != null ? new SchemaJsonException(schemaJsonResult, Encoding.UTF8.GetString(message)) : Empty(schemaJsonResult); | ||
|
||
private SchemaJsonException(SchemaJsonResult schemaJsonResult, string message) : base(message) => this.SchemaJsonResult = schemaJsonResult; | ||
|
||
private static SchemaJsonException Empty(SchemaJsonResult schemaJsonResult) => new(schemaJsonResult, EmptyErrorMessage); | ||
} |
Oops, something went wrong.