using System; using System.Collections.Generic; using System.Text; using Google.ProtocolBuffers.Collections; namespace Google.ProtocolBuffers.ProtoGen { /// /// Exception thrown to indicate that the options passed were invalid. /// public sealed class InvalidOptionsException : Exception { private readonly IList reasons; /// /// An immutable list of reasons why the options were invalid. /// public IList Reasons { get { return reasons; } } public InvalidOptionsException(IList reasons) : base(BuildMessage(reasons)) { this.reasons = Lists.AsReadOnly(reasons); } private static string BuildMessage(IEnumerable reasons) { StringBuilder builder = new StringBuilder("Invalid options:"); builder.AppendLine(); foreach (string reason in reasons) { builder.Append(" "); builder.AppendLine(reason); } return builder.ToString(); } } }