title: Catching FULL exception message
body: <p>Consider:</p>
  
  <pre><code>Invoke-WebRequest $sumoApiURL -Headers @{"Content-Type"= "application/json"} -Credential $cred -WebSession $webRequestSession -Method post -Body $sumojson -ErrorAction Stop
  </code></pre>
  
  <p>This throws the following exception:</p>
  
  <p><a href="https://i.stack.imgur.com/Lg7aA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Lg7aA.png" alt="Enter image description here"></a></p>
  
  <p>How can I catch it entirely or at least filter out the "A resource with the same name already exist."?</p>
  
  <p>Using <code>$_.Exception.GetType().FullName</code> yields</p>
  
  <blockquote>
    <p>System.Net.WebException</p>
  </blockquote>
  
  <p>and <code>$_.Exception.Message</code> gives</p>
  
  <blockquote>
    <p>The remote server returned an error: (400) Bad Request.</p>
  </blockquote>