这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@colombod
Copy link
Member

@colombod colombod commented Jul 8, 2019

No description provided.

public void Register(ICodeSubmissionProcessor processor)
public void Add(ICodeSubmissionProcessor processor)
{
_processors[processor.Command] = processor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add seems like a misleading name if this can also replace an existing processor.

Copy link
Member Author

@colombod colombod Jul 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to add so we throw exceptions when overriding

Copy link
Contributor

@jonsequitur jonsequitur Jul 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still obscure the intention. A more honest name would be something like SetProcessorForCommand.


return new SubmitCode(string.Join("\n", unhandledLines), codeSubmission.Id, codeSubmission.ParentId);
}
catch (Exception e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems overly broad. We should ideally only catch exceptions that we understand, as this might otherwise mask some of our own bugs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is wrapping all exceptions so we capture the exception and the code submission

var renderer = FindRenderer(source.GetType());
return renderer.Render(source, this);
}
catch (Exception e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason (e.g. expected exception type) to do this? catch Exception is something that should typically only ever happen at a much higher level in the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is wrapping as well, and capturing the evaluation result


var state = getScriptState();

var codeFile = new FileInfo(Path.Combine(options.Output.FullName, "code.cs"));
Copy link
Contributor

@jonsequitur jonsequitur Jul 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be made to work against IDirectoryAccessor from the outset.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed

{
public SubmitCode CodeSubmission { get; }

public CodeSubmissionProcessorException(Exception exception, SubmitCode codeSubmission) : base("CodeSubmission processing failed", exception)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be helpful to refer to the processor that failed.

@colombod colombod force-pushed the feature/emit_processor branch from d556439 to 238d7ec Compare July 9, 2019 23:55
@colombod colombod closed this Jul 10, 2019
@colombod colombod deleted the feature/emit_processor branch July 10, 2019 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants