Created
April 11, 2012 11:59
-
-
Save SzymonPobiega/2358879 to your computer and use it in GitHub Desktop.
Too much DRY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static T NullArgumentLogAndThrow<T>(this ILog log, T arg) | |
{ | |
if (arg.IsNotNull()) return arg; | |
// get calling method | |
var ex = new ArgumentNullException(typeof(T).Name); | |
log.Fatal(new StackTrace().GetFrame(1).GetMethod().Name, ex); | |
log.Fatal(new StackTrace().ToString()); | |
throw ex; | |
} | |
//... | |
this.requestMapper = log.NullArgumentLogAndThrow(requestMapper); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment