title: Autoit - Validate windows share user authentication
body: <p>I'm trying to connect to a windows share (\print) but if my authentication fails, for example, wrong username or password, how can i catch that error?
  The problem is that when executing the script (exe. file), if i insert wrong credentials, the error message is from Autoit program and not the message i would like to pop up (code above) if there is some problem with the authentication.</p>
  
  <p>Here is a sample of my code:</p>
  
  <p>Here I try connect to the server \print with username and password</p>
  
  <pre><code>$WshNetwork = ObjCreate("WScript.Network")
  $WshNetwork.MapNetworkDrive("", "\\print", True, $username, $password)
  </code></pre>
  
  <p>The values of $username and $password are filled from an Inputbox.
  So, after that code i tried to catch the error like this:</p>
  
  <pre><code>if @error Then
      MsgBox(16, "", "Authentication error!")
  EndIf
  </code></pre>
  
  <p>And by the way, the error i got from the console is this one:</p>
  
  <pre><code>C:\Users\user\Desktop\test.au3 (33) : ==&gt; The requested action with this object has failed.:
  $WshNetwork.MapNetworkDrive( "","\\print",True, $username, $password)
  $WshNetwork.MapNetworkDrive( "","\\print",True, $username, $password)^ ERROR
  </code></pre>
  
  <p>Well, the error is happening, but is there some way to catch the error from the code and send an alert (Msgbox)?</p>