title: Is it good practice to extract common exception throwing logic into its own method?
body: <p>We have the following repeated in our codebase:</p>
  
  <pre><code>var isUpdateAllowed = await this.security.IsUpdateAllowedAsync(userId, postId);
  if (!isUpdateAllowed)
  {
      throw new UnauthorizedException(string.Format(
          "Not allowed to update post. User={0} Post={1}",
          userId,
          postId));
  }
  </code></pre>
  
  <p>We've already had to change the exception type once, which involved changing it in many places, so it seems like repeating the above violates DRY.</p>
  
  <p>One proposed solution is we extract the above check into its own method. It can exist alongside the existing <code>IsUpdateAllowedAsync</code> method. We can call it <code>AssertUpdateAllowedAsync</code>. The call-site then becomes: </p>
  
  <pre><code>await this.security.AssertUpdateAllowedAsync(userId, postId);
  </code></pre>
  
  <p>I'm personally torn: on one hand we get DRY, but on the other hand I can't remember seeing many methods, other than <code>Assert.</code> in MSTest, that use the above convention.</p>