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