}
#endregion
+
+ /// <summary>
+ /// This method supports the product infrastructure and is not intended to be used directly from application code.
+ /// </summary>
+ protected static Exception GetException(int errorCode, string message) =>
+ ((PlayerErrorCode) errorCode).GetException(message);
}
}
return;
}
+ throw err.GetException(message);
+ }
+
+ internal static Exception GetException(this PlayerErrorCode err, string message)
+ {
+ if (err == PlayerErrorCode.None)
+ {
+ return null;
+ }
+
string msg = $"{ (message ?? "Operation failed") } : { err.ToString() }.";
switch (err)
case PlayerErrorCode.DrmNoLicense:
case PlayerErrorCode.DrmFutureUse:
case PlayerErrorCode.DrmNotPermitted:
- // TODO consider another exception.
+ // TODO consider another exception.
case PlayerErrorCode.InvalidOperation:
case PlayerErrorCode.InvalidState:
case PlayerErrorCode.SeekFailed:
}
- throw new Exception(msg);
+ throw new InvalidOperationException(msg);
}
}