mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-28 17:05:57 +00:00
throw more detailed exceptions for type not found and interface mismatches
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Octokit.Tests.Conventions
|
||||
{
|
||||
public class InterfaceHasAdditionalMethodsException : Exception
|
||||
{
|
||||
public InterfaceHasAdditionalMethodsException(Type type, IEnumerable<string> methodsMissingOnReactiveClient)
|
||||
: base(CreateMessage(type, methodsMissingOnReactiveClient)) { }
|
||||
|
||||
public InterfaceHasAdditionalMethodsException(Type type, IEnumerable<string> methodsMissingOnReactiveClient, Exception innerException)
|
||||
: base(CreateMessage(type, methodsMissingOnReactiveClient), innerException) { }
|
||||
|
||||
protected InterfaceHasAdditionalMethodsException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) { }
|
||||
|
||||
static string CreateMessage(Type type, IEnumerable<string> methods)
|
||||
{
|
||||
var methodsFormatted = String.Join("\r\n", methods.Select(m => String.Format(" - {0}", m)));
|
||||
return String.Format("Methods found on type {0} which should be removed:\r\n{1}", type.Name, methodsFormatted);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user