/// <summary> /// Throws an exception if certain conditions are met. /// </summary> /// <param name="objError"></param> /// <param name="serializer"></param> private static void ThrowIfNestedError(object objError, JavaScriptSerializer serializer) { if (objError != null) { BrightcoveError error = serializer.ConvertToType <BrightcoveError>(objError); throw new BrightcoveApiException(error); } }
/// <summary> /// Constructor. /// </summary> /// <param name="error">An encountered <see cref="BrightcoveError"/>.</param> public BrightcoveApiException(BrightcoveError error) { _error = error; _message = String.Format("An error was returned by the server while accessing the API: {0} - {1} (code {2})", error.Name, error.Message, error.Code); }