Files
Grégoire Geis 0ab2b81261 Refactor to target .NET Standard 1.1 (#344)
* Refactor to target .NET Standard 1.1

* Added Nuget details to .csproj

* Reviewed Engine methods and docs; added own Exception type.

* Added migration guide for .NET bindings.
2018-08-02 10:49:31 +08:00

31 lines
818 B
C#

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Keystone
{
/// <summary>
/// Represents an error encountered while encoding one or more instructions.
/// </summary>
public sealed class KeystoneException : Exception
{
/// <summary>
/// Gets the value that represents the encountered error.
/// </summary>
public KeystoneError Error { get; }
internal KeystoneException(string message, KeystoneError error) : base(message + '.')
{
Debug.Assert(error != KeystoneError.KS_ERR_OK);
Error = error;
}
/// <inheritdoc />
public override string ToString()
{
return $"{Message}: {Engine.ErrorToString(Error)}.";
}
}
}