123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- using System;
- namespace NRKernal
- {
- public enum Level
- {
- High,
- Normal,
- }
- /// <summary> A nr kernal error. </summary>
- public class NRKernalError : ApplicationException
- {
- public Level level;
- /// <summary> The error message. </summary>
- protected string msg;
- /// <summary> The inner exception. </summary>
- protected Exception innerException;
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRKernalError(string msg, Level level = Level.Normal, Exception innerException = null) : base(msg)
- {
- this.innerException = innerException;
- this.msg = msg;
- this.level = level;
- }
- /// <summary> Gets the error. </summary>
- /// <returns> The error. </returns>
- virtual public string GetErrorMsg()
- {
- return msg;
- }
- }
- #region native error
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /// /// internal errors
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /// <summary> A nr kernal error. </summary>
- public class NRNativeError : NRKernalError
- {
- public NativeResult result;
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRNativeError(NativeResult result, string msg, Level level = Level.Normal, Exception innerException = null) : base(msg, level, innerException)
- {
- this.result = result;
- }
- /// <summary> Gets the error. </summary>
- /// <returns> The error. </returns>
- override public string GetErrorMsg()
- {
- return string.Format("Error Code-{0}: {1}", (int)result, msg);
- }
- }
- /// <summary> A nr invalid argument error. </summary>
- public class NRInvalidArgumentError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRInvalidArgumentError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.Normal, innerException)
- {
- }
- }
- /// <summary> A nr not enough memory error. </summary>
- public class NRNotEnoughMemoryError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRNotEnoughMemoryError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException)
- {
- }
- }
- /// <summary> A nr sdcard permission deny error. </summary>
- public class NRSdcardPermissionDenyError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRSdcardPermissionDenyError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException)
- {
- }
- }
- /// <summary> A nr un supported error. </summary>
- public class NRUnSupportedError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRUnSupportedError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException)
- {
- }
- }
- /// <summary> A nr glasses connect error. </summary>
- public class NRGlassesConnectError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRGlassesConnectError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException)
- {
- }
- }
- /// <summary> A nr sdk version mismatch error. </summary>
- public class NRSdkVersionMismatchError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRSdkVersionMismatchError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException)
- {
- }
- }
- /// <summary> A nr rgb camera device not find error. </summary>
- public class NRRGBCameraDeviceNotFindError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRRGBCameraDeviceNotFindError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.Normal, innerException)
- {
- }
- }
- /// <summary> Display device not find error. </summary>
- public class NRDPDeviceNotFindError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRDPDeviceNotFindError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException)
- {
- }
- }
- /// <summary> MRSpace display device not find error. </summary>
- public class NRGetDisplayFailureError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRGetDisplayFailureError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException)
- {
- }
- }
- /// <summary> Display Mode mismatch error, as MRSpace mode is needed. </summary>
- public class NRDisplayModeMismatchError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRDisplayModeMismatchError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException)
- {
- }
- }
- /// <summary> A device not support hand tracking calculation error. </summary>
- public class NRUnSupportedHandtrackingCalculationError : NRNativeError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRUnSupportedHandtrackingCalculationError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.Normal, innerException)
- {
- }
- }
- #endregion
- #region internal error
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /// /// internal errors
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /// <summary> A nr internal error. </summary>
- public class NRInternalError : NRKernalError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRInternalError(string msg, Level level = Level.Normal, Exception innerException = null) : base(msg, level, innerException)
- {
- }
- }
- public class NRMissingKeyComponentError : NRInternalError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRMissingKeyComponentError(string msg, Exception innerException = null) : base(msg, Level.High, innerException)
- {
- }
- }
- public class NRPermissionDenyError : NRInternalError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRPermissionDenyError(string msg, Exception innerException = null) : base(msg, Level.Normal, innerException)
- {
- }
- }
- public class NRUnSupportDeviceError : NRInternalError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRUnSupportDeviceError(string msg, Exception innerException = null) : base(msg, Level.High, innerException)
- {
- }
- }
- /// <summary> A nr glasses not available error. </summary>
- public class NRGlassesNotAvailbleError : NRInternalError
- {
- /// <summary> Constructor. </summary>
- /// <param name="msg"> The message.</param>
- /// <param name="innerException"> (Optional) The inner exception.</param>
- public NRGlassesNotAvailbleError(string msg, Exception innerException = null) : base(msg, Level.High, innerException)
- {
- }
- }
- #endregion
- }
|