/// <summary> /// Create a new instance of <see cref="WinApiError"/> /// </summary> /// <param name="errorCode"><see cref="int"/> of the error code thrown during the WinApi call</param> public WinApiError(int errorCode) { if (!Enum.IsDefined(typeof(WinApiErrorType), errorCode)) { throw new InvalidOperationException($"{errorCode} is not an underlying value of {typeof(WinApiErrorType)}"); } Error = (WinApiErrorType)errorCode; }
/// <summary> /// Create a new instance of <see cref="WinApiError"/> /// </summary> /// <param name="errorType"><see cref="WinApiErrorType"/> of the thrown error during the WinApi call</param> public WinApiError(WinApiErrorType errorType) { Error = errorType; }