mirror of
https://github.com/keystone-engine/keystone
synced 2026-06-08 15:15:30 +00:00
0ab2b81261
* 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.
31 lines
818 B
C#
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)}.";
|
|
}
|
|
}
|
|
}
|