本文整理汇总了C#中IErrorHandler类的典型用法代码示例。如果您正苦于以下问题:C# IErrorHandler类的具体用法?C# IErrorHandler怎么用?C# IErrorHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IErrorHandler类属于命名空间,在下文中一共展示了IErrorHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NancyEngine
/// <summary>
/// Initializes a new instance of the <see cref="NancyEngine"/> class.
/// </summary>
/// <param name="resolver">An <see cref="IRouteResolver"/> instance that will be used to resolve a route, from the modules, that matches the incoming <see cref="Request"/>.</param>
/// <param name="routeCache">Cache of all available routes</param>
/// <param name="contextFactory">A factory for creating contexts</param>
/// <param name="errorHandler">Error handler</param>
public NancyEngine(IRouteResolver resolver, IRouteCache routeCache, INancyContextFactory contextFactory, IErrorHandler errorHandler)
{
if (resolver == null)
{
throw new ArgumentNullException("resolver", "The resolver parameter cannot be null.");
}
if (routeCache == null)
{
throw new ArgumentNullException("routeCache", "The routeCache parameter cannot be null.");
}
if (contextFactory == null)
{
throw new ArgumentNullException("contextFactory");
}
if (errorHandler == null)
{
throw new ArgumentNullException("errorHandler");
}
this.resolver = resolver;
this.routeCache = routeCache;
this.contextFactory = contextFactory;
this.errorHandler = errorHandler;
}
示例2: MetadataImporter
public MetadataImporter(CompilerOptions options, IErrorHandler errorHandler) {
Debug.Assert(options != null);
Debug.Assert(errorHandler != null);
_options = options;
_errorHandler = errorHandler;
}
示例3: Parse
public virtual void Parse(string code, IErrorHandler errorHandler)
{
this._engine.Reset();
this._errorHandler = errorHandler;
this._codeBlock.SourceText = code;
this._engine.CheckForErrors();
}
示例4: foreach
bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErrorHandler errorHandler)
{
CompilationUnitNode compilationUnitNode = (CompilationUnitNode)node;
foreach (AttributeBlockNode attribBlock in compilationUnitNode.Attributes) {
AttributeNode scriptNamespaceNode = AttributeNode.FindAttribute(attribBlock.Attributes, "ScriptNamespace");
if (scriptNamespaceNode != null) {
string scriptNamespace = (string)((LiteralNode)scriptNamespaceNode.Arguments[0]).Value;
if (Utility.IsValidScriptNamespace(scriptNamespace) == false) {
errorHandler.ReportError("A script namespace must be a valid script identifier.",
scriptNamespaceNode.Token.Location);
}
}
}
foreach (ParseNode childNode in compilationUnitNode.Members) {
if (!(childNode is NamespaceNode)) {
errorHandler.ReportError("Non-namespaced types are not supported.",
childNode.Token.Location);
return false;
}
}
return true;
}
示例5: QuietTextWriter
/// <summary>
/// Constructor
/// </summary>
/// <param name="writer">the writer to actually write to</param>
/// <param name="errorHandler">the error handler to report error to</param>
/// <remarks>
/// <para>
/// Create a new QuietTextWriter using a writer and error handler
/// </para>
/// </remarks>
public QuietTextWriter(TextWriter writer, IErrorHandler errorHandler)
: base(writer) {
if (errorHandler == null) {
throw new ArgumentNullException("errorHandler");
}
ErrorHandler = errorHandler;
}
示例6: NancyEngineFixture
public NancyEngineFixture()
{
this.resolver = A.Fake<IRouteResolver>();
this.response = new Response();
this.route = new FakeRoute(response);
this.context = new NancyContext();
this.errorHandler = A.Fake<IErrorHandler>();
this.requestDispatcher = A.Fake<IRequestDispatcher>();
A.CallTo(() => this.requestDispatcher.Dispatch(A<NancyContext>._)).Invokes(x => this.context.Response = new Response());
A.CallTo(() => errorHandler.HandlesStatusCode(A<HttpStatusCode>.Ignored, A<NancyContext>.Ignored)).Returns(false);
contextFactory = A.Fake<INancyContextFactory>();
A.CallTo(() => contextFactory.Create()).Returns(context);
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(new ResolveResult(route, DynamicDictionary.Empty, null, null, null));
var applicationPipelines = new Pipelines();
this.routeInvoker = A.Fake<IRouteInvoker>();
A.CallTo(() => this.routeInvoker.Invoke(A<Route>._, A<DynamicDictionary>._, A<NancyContext>._)).ReturnsLazily(arg =>
{
return (Response)((Route)arg.Arguments[0]).Action.Invoke((DynamicDictionary)arg.Arguments[1]);
});
this.engine =
new NancyEngine(this.requestDispatcher, contextFactory, new[] { this.errorHandler }, A.Fake<IRequestTracing>())
{
RequestPipelinesFactory = ctx => applicationPipelines
};
}
示例7: Database
public Database(ILogger logger, IErrorHandler handler)
{
m_logger = logger;
m_handler = handler;
Console.WriteLine("In Database .ctor");
}
示例8:
bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErrorHandler errorHandler) {
NewNode newNode = (NewNode)node;
// TODO: This is somewhat hacky - it only looks for any type named Dictionary
// rather than resolving the type and checking if its actually
// System.Dictionary.
// This is because validators don't have a reference to the SymbolSet.
NameNode typeNode = newNode.TypeReference as NameNode;
if ((typeNode != null) && (typeNode.Name.Equals("Dictionary"))) {
if (newNode.Arguments != null) {
Debug.Assert(newNode.Arguments is ExpressionListNode);
ParseNodeList arguments = ((ExpressionListNode)newNode.Arguments).Expressions;
if (arguments.Count != 0) {
if (arguments.Count % 2 != 0) {
errorHandler.ReportError("Missing value parameter for the last name parameter in Dictionary instantiation.",
newNode.Token.Location);
}
for (int i = 0; i < arguments.Count; i += 2) {
ParseNode nameArgumentNode = arguments[i];
if ((nameArgumentNode.NodeType != ParseNodeType.Literal) ||
(((LiteralNode)nameArgumentNode).Literal.LiteralType != LiteralTokenType.String)) {
errorHandler.ReportError("Name parameters in Dictionary instantiation must be string literals.",
nameArgumentNode.Token.Location);
}
}
}
}
}
return true;
}
示例9: ErrorHandlingTaskExecutor
/// <summary>
/// create a new <see cref="ErrorHandlingTaskExecutor"/> with <paramref name="taskExecutor"/> and
/// <paramref name="errorHandler"/>
/// </summary>
/// <param name="taskExecutor">the task executor</param>
/// <param name="errorHandler">the error handler in case of an exception</param>
public ErrorHandlingTaskExecutor(IExecutor taskExecutor, IErrorHandler errorHandler)
{
AssertUtils.ArgumentNotNull(taskExecutor, "taskExecutor must not be null");
AssertUtils.ArgumentNotNull(errorHandler, "errorHandler must not be null");
_taskExecutor = taskExecutor;
_errorHandler = errorHandler;
}
示例10: StaffingResourcePhoneListViewModel
public StaffingResourcePhoneListViewModel(IDomainUnitOfWorkManager<IDomainUnitOfWork> unitOfWorkManager,
IPartFactory<ItemSelectorViewModel> phoneTypeSelectorFactory,
IErrorHandler errorHandler, IDialogManager dialogManager)
: base(unitOfWorkManager, errorHandler)
{
_phoneTypeSelectorFactory = phoneTypeSelectorFactory;
_dialogManager = dialogManager;
}
示例11: ErrorClientBehavior
public ErrorClientBehavior(IErrorHandler errorHandler)
{
if (errorHandler == null)
{
throw new ArgumentNullException();
}
_errorHandler = errorHandler;
}
示例12: ExternalThread
public ExternalThread(string name, IRuntime runtime, IActorLogger logger, IErrorHandler errorHandler, Action<Action> dispatchMethod)
{
_name = name;
_runtime = runtime;
_logger = logger;
_errorHandler = errorHandler;
_dispatcher = dispatchMethod;
}
示例13: RequestLifecycleHandler
/// <summary>Creates a new instance of the RequestLifeCycleHandler class.</summary>
/// <param name="webContext">The web context wrapper.</param>
public RequestLifecycleHandler(IWebContext webContext, EventBroker broker, InstallationManager installer, IRequestDispatcher dispatcher, IErrorHandler errors, AdminSection editConfig, HostSection hostConfig)
: this(webContext, broker, installer, dispatcher, errors)
{
checkInstallation = editConfig.Installer.CheckInstallationStatus;
//installerUrl = editConfig.Installer.InstallUrl;
rewriteMethod = hostConfig.Web.Rewrite;
_adminConfig = editConfig;
}
示例14: StaffingResourceSummaryViewModel
public StaffingResourceSummaryViewModel(IDomainUnitOfWorkManager<IDomainUnitOfWork> unitOfWorkManager,
IPartFactory<StaffingResourceNameEditorViewModel> nameEditorFactory,
IErrorHandler errorHandler, IDialogManager dialogManager)
: base(unitOfWorkManager, errorHandler)
{
_nameEditorFactory = nameEditorFactory;
_dialogManager = dialogManager;
}
示例15: StatementBuilder
public StatementBuilder(ILocalSymbolTable symbolTable, CodeMemberSymbol memberContext, IErrorHandler errorHandler, CompilerOptions options) {
_symbolTable = symbolTable;
_memberContext = memberContext;
_symbolSet = memberContext.SymbolSet;
_errorHandler = errorHandler;
_expressionBuilder = new ExpressionBuilder(symbolTable, memberContext, errorHandler, options);
}