Skip to content

Catch and log exceptions thrown by TryPrepareFolderForCallbacks#280

Merged
wilbaker merged 3 commits intomicrosoft:masterfrom
wilbaker:trypreparefolderforcallbacks_exception
Sep 24, 2018
Merged

Catch and log exceptions thrown by TryPrepareFolderForCallbacks#280
wilbaker merged 3 commits intomicrosoft:masterfrom
wilbaker:trypreparefolderforcallbacks_exception

Conversation

@wilbaker
Copy link
Member

@wilbaker wilbaker commented Sep 18, 2018

Fixes #278

TryPrepareFolderForCallbacks can throw a FileNotFoundException if ProjFS is not properly installed\enabled. Prior to these changes, when an exception occurred the exception would not be logged and the full call stack would be displayed to the user on the console.

With these changes any exceptions thrown by TryPrepareFolderForCallbacks will be caught and recorded to the log file.

@wilbaker wilbaker self-assigned this Sep 18, 2018
@wilbaker wilbaker changed the title Catch and log exceptions thrown by ConvertDirectoryToVirtualizationRoot WIP: Catch and log exceptions thrown by ConvertDirectoryToVirtualizationRoot Sep 18, 2018
@wilbaker wilbaker added the WIP label Sep 18, 2018
@wilbaker wilbaker changed the title WIP: Catch and log exceptions thrown by ConvertDirectoryToVirtualizationRoot Catch and log exceptions thrown by TryPrepareFolderForCallbacks Sep 18, 2018
@wilbaker wilbaker removed the WIP label Sep 18, 2018
@wilbaker
Copy link
Member Author

@sanoursa I made another round of changes based on your feedback. Please let me know what you think.

Copy link
Contributor

@sanoursa sanoursa left a comment

Choose a reason for hiding this comment

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

Looks good

}

public bool TryPrepareFolderForCallbacks(string folderPath, out string error)
public bool TryPrepareFolderForCallbacks(string folderPath, out string error, out Exception exception)
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: both of the out params are only used for tracing errors. Should this method just take an ITracer as an input param and writes out its own errors?

Copy link
Member Author

@wilbaker wilbaker Sep 24, 2018

Choose a reason for hiding this comment

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

both of the out params are only used for tracing errors

@sanoursa, the exception parameter is only used for tracing, but the error out param is used for both tracing and for letter the user know (on the command line) why their clone has failed.

I can update TryPrepareFolderForCallbacks to take an ITracer (and remove the out exception), but we'd still need an out error parameter.

Let me know if you think it's worth making that change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed with @sanoursa offline and I will merge this in as-is.

@wilbaker wilbaker merged commit a074575 into microsoft:master Sep 24, 2018
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.

3 participants