Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specialize Exceptions thrown by UpdateManager (PR in hand!) #1386

Open
ewlloyd opened this issue Sep 15, 2018 · 0 comments
Open

Specialize Exceptions thrown by UpdateManager (PR in hand!) #1386

ewlloyd opened this issue Sep 15, 2018 · 0 comments
Labels
feature:requested Suggestions to enhance the library

Comments

@ewlloyd
Copy link

ewlloyd commented Sep 15, 2018

Thanks for a great product!

One thing, though... Wouldn't it be better if client applications could respond to the specific error conditions reported by the UpdateManager class without having to parse the messages and guess? Let me propose the use of specialized exception classes to replace the bare System.Exceptions thrown today:

using(var mgr = new UpdateManager(squirrelSource)) {
	try {
		await mgr.UpdateApp();
	} catch(SquirrelNoUpdateException ex) {		
		// TODO: Deal with missing Update.exe,
		//       including ignoring it if we're running from source
	} catch(SquirrelReleasesMissingException ex) {
		// TODO: Deal with missing Releases folder
	} catch(SquirrelReleasesCorruptException ex) {
		// TODO: Deal with empty/corrupt RELEASES file
	} // otherwise continue throwing
}

All three exceptions noted above would be derived from SquirrelBaseException, so you have exactly the precision you need when customizing your catch blocks.

As noted above, I've implemented this in my fork, and I'll have a PR to you shortly.

@shiftkey shiftkey added the feature:requested Suggestions to enhance the library label May 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:requested Suggestions to enhance the library
Projects
None yet
Development

No branches or pull requests

2 participants