/// <summary> /// Constructor. /// </summary> /// <param name="nestedError">An encountered <see cref="BrightcoveNestedError"/>.</param> public BrightcoveApiException(BrightcoveNestedError nestedError) { _error = nestedError; StringBuilder sb = new StringBuilder(); sb.AppendFormat("An error was returned by the server while accessing the API: {0} (code {1})", nestedError.Message, nestedError.Code); if (nestedError.Errors.Count > 0) { sb.AppendFormat("\nThe following errors were encountered:"); foreach (BrightcoveNestedError error in nestedError.Errors) { sb.AppendFormat("\n\t{0} (code {1})", error.Message, error.Code); } } _message = sb.ToString(); }
/// <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); }