public static ArgumentOutOfRangeException ArgumentOutOfRange(this EnsureExceptionHelper guard, string argumentName, string format, params object[] formatParameters) { Ensure.NotNull(guard, "guard"); Ensure.NotNullOrEmpty(argumentName, "argumentName"); Ensure.NotNullOrEmpty(format, "format"); return(new ArgumentOutOfRangeException(argumentName, String.Format(format, formatParameters))); }
public static ArgumentOutOfRangeException NotGuidKey(this EnsureExceptionHelper exception, Type keyType, string argumentName) { return(Ensure.Exception.ArgumentOutOfRange( argumentName, "The entity event store currently supportes only Guid keys, not '{0}'.", keyType.Name )); }
public static ArgumentOutOfRangeException NotSupportedConversion(this EnsureExceptionHelper ensure, Type targetType, object sourceValue) { return(ensure.ArgumentOutOfRange( "TTarget", "Target type '{0}' can't be constructed from a value '{1}'.", targetType.FullName, sourceValue )); }
public static NotSupportedException NotSupported(this EnsureExceptionHelper guard, string format = null, params object[] formatParameters) { Ensure.NotNull(guard, "guard"); if (String.IsNullOrEmpty(format)) { return(new NotSupportedException()); } return(new NotSupportedException(String.Format(format, formatParameters))); }
/// <summary> /// Returns an instance of the <see cref="InvalidOperationException"/> with a message about undefined type of the <paramref name="handler"/>. /// </summary> public static InvalidOperationException UndefinedHandlerType(this EnsureExceptionHelper ensure, HandlerDescriptor handler) { return Ensure.Exception.InvalidOperation("The handler '{0}' is of undefined type (not plain, not envelope, not context).", handler.HandlerIdentifier); }
public static PipelineFactoryException UnCompilableSource(this EnsureExceptionHelper helper, string sourceCodePath) { return(new PipelineFactoryException(String.Format("Error during compilation of generated pipeline, source code saved to '{0}'.", sourceCodePath))); }
/// <summary> /// Creates new instance of <see cref="DependencyResolutionFailedException"/> problem with resolving <paramref name="requiredType"/> occurred. /// </summary> /// <typeparam name="T">Type of service resolution failed.</typeparam> /// <param name="exception">Exception helper.</param> /// <param name="requiredType">Service type where resolution failed.</param> /// <param name="inner">Source exception.</param> /// <returns>New instance of <see cref="DependencyResolutionFailedException"/> problem with resolving <paramref name="requiredType"/> occurred.</returns> public static DependencyResolutionFailedException NotResolvable(this EnsureExceptionHelper exception, Type requiredType, Exception inner) { Ensure.NotNull(exception, "exception"); Ensure.NotNull(requiredType, "requiredType"); return(new DependencyResolutionFailedException(String.Format("Problem resolving type '{0}'.", requiredType.FullName), inner)); }
public static ArgumentOutOfRangeException ArgumentDirectoryNotExist(this EnsureExceptionHelper guard, string path, string argumentName) { return(guard.ArgumentOutOfRange(argumentName, "Path must point to an existing directory, Path '{0}' doesn't exist.", path)); }
public static NotSupportedException NotSupportedMethod(this EnsureExceptionHelper ensure, RouteMethod method) { Ensure.NotNull(ensure, "ensure"); return(ensure.NotSupported("Not supported route method '{0}'.", method)); }
public static NotSupportedException NotSupportedSerialization(this EnsureExceptionHelper ensure, RouteSerialization serialization) { Ensure.NotNull(ensure, "ensure"); return(ensure.NotSupported("Not supported serialization type '{0}'.", serialization)); }
public static NotSupportedException NotSupportedSearchMode(this EnsureExceptionHelper ensure, FileSearchMode mode) { return(Ensure.Exception.NotSupported("Not supported file search mode '{0}'.", mode)); }
/// <summary> /// Creates exception <see cref="InvalidOperationException"/> for argument <paramref name="argumentName"/> /// and message formatted from <paramref name="format"/> and <paramref name="formatParameters"/>. /// </summary> /// <param name="guard"></param> /// <param name="argumentName"></param> /// <param name="format"></param> /// <param name="formatParameters"></param> /// <returns><see cref="InvalidOperationException"/>.</returns> public static InvalidOperationException InvalidOperation(this EnsureExceptionHelper guard, string format, params object[] formatParameters) { Ensure.NotNull(guard, "guard"); Ensure.NotNullOrEmpty(format, "format"); return(new InvalidOperationException(String.Format(format, formatParameters))); }
public static NotSupportedException NotSupported <TEnum>(this EnsureExceptionHelper ensure, TEnum value) where TEnum : struct { return(NotSupported(ensure, "The value '{0}' from the '{1}' is not supported in this context.", value, typeof(TEnum).FullName)); }
/// <summary> /// Creates new instance of <see cref="DependencyContainerScopeResolutionFailedException"/> when problem with resolving child scope occurred. /// </summary> /// <param name="exception">Exception helper.</param> /// <param name="requiredType">Service type where resolution failed.</param> /// <param name="inner">Source exception.</param> /// <returns>New instance of <see cref="DependencyContainerScopeResolutionFailedException"/> when problem with resolving child scope occurred.</returns> public static DependencyResolutionFailedException NotResolvableChildScope(this EnsureExceptionHelper exception, Type requiredType, DependencyResolutionFailedException inner) { Ensure.NotNull(exception, "exception"); Ensure.NotNull(requiredType, "requiredType"); return(new DependencyContainerScopeResolutionFailedException(requiredType, inner)); }
/// <summary> /// Creates new instance of <see cref="DependencyResolutionFailedException"/> when problem with resolving <paramref name="requiredType"/> occurred. /// </summary> /// <param name="exception">Exception helper.</param> /// <param name="requiredType">Service type where resolution failed.</param> /// <returns>New instance of <see cref="DependencyResolutionFailedException"/> when problem with resolving <paramref name="requiredType"/> occurred.</returns> public static DependencyResolutionFailedException NotResolvable(this EnsureExceptionHelper exception, Type requiredType) { Ensure.NotNull(exception, "exception"); Ensure.NotNull(requiredType, "requiredType"); return(new DependencyResolutionFailedException(requiredType)); }
public static FileSystemException FileSystem(this EnsureExceptionHelper guard, string format, params object[] formatParameters) { Ensure.NotNull(guard, "guard"); Ensure.NotNullOrEmpty(format, "format"); return(new FileSystemException(String.Format(format, formatParameters))); }