Skip to content

Very small utility used to handle exceptions without polluting the code base. Adding it here, because got tired of rewriting it again.

License

Notifications You must be signed in to change notification settings

jakubkrzysztofsikora/TryCatchBuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TryCatchBuilder

Very small utility used to handle exceptions without polluting the code base. Adding it here, because got tired of rewriting it again.

Nuget Package: https://www.nuget.org/packages/TryCatchBuilder/

How to use:

Func<int> wrappedFunction = TryCatchBuilder<int>
				.Try(functionToWrap)
				.Catch<Exception>(actionOnFail)
				.Build();
wrappedFunction();
Func<int> wrappedFunction = TryCatchBuilder<int>
				.Try(functionToWrap)
				.Catch<Exception>(JustCountTheRetries)
				.ReTry(numberofRetries, baseRetryInterval: TimeSpan.FromMilliseconds(50), retryIncrement: TimeSpan.FromMilliseconds(1))
				.OnRepeatedFailure(actionOnRepeatedFail)
				.Build();
wrappedFunction();

About

Very small utility used to handle exceptions without polluting the code base. Adding it here, because got tired of rewriting it again.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages