Repository: microsoft/ptvsd

Issue:
Uncaught exceptions shows error in ptvsd
![image](https://user-images.githubusercontent.com/3840081/36622305-5412fe64-18b1-11e8-8efa-cf5a7f381a8b.png)


File contents:
```
raise ValueError
```


Discussion:
Dupe #109
Looks like this might be different from #109. This is the order of events in ptvsd:
```
pydev debugger: starting

Traceback (most recent call last):
  File "C:\USERS\KANADIG\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\15.0_DCFC3D47EXP\EXTENSIONS\MICROSOFT CORPORATION\PYTHON\3.0\ptvsd_launcher.py", line 96, in <module>
    vspd.debug(filename, port_num, debug_id, debug_options, run_as)
  File "G:\pyenv\test1\lib\site-packages\ptvsd\debugger.py", line 33, in debug
    pydevd.main()
  File "G:\pyenv\test1\lib\site-packages\ptvsd\pydevd\pydevd.py", line 1629, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "G:\pyenv\test1\lib\site-packages\ptvsd\pydevd\pydevd.py", line 1036, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "G:\pyenv\test1\lib\site-packages\ptvsd\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:\Users\kanadig\Source\Repos\PyScratch\Scratch\Scratch.py", line 1, in <module>
    raise ValueError
ValueError
Created : MainThread pid_19680_id_2198912886152
Created : ptvsd.EventLoop pid_19680_id_2198927997864
Created : ptvsd.Client pid_19680_id_2198927998480
Suspended : None pid_19680_id_2198912886152
suspend reason: 122
Exception info request: pid_19680_id_2198912886152
```
This causes a failure in `on_exceptionInfo` because we have not yet stored the exception info for the main thread. the `CMD_SEND_CURR_EXCEPTION_TRACE` event from pydev has not yet occurred. we store the exception info in the handler for that event.
@int19h is there another way to get exception info for a thread? 
PS: I looked at the arguments for the `CMD_THREAD_SUSPEND` event from pydev. It has a message field, but in my case where the error is `ValueError` the message filed had `BaseException`. So i think we may need a different mechanism to get the exact error info.
Sample XML received on susped with reason `122` or `CMD_ADD_EXCEPTION_BREAK`
```
<xml>
    <thread id="pid_19680_id_2198912886152" stop_reason="122" message="BaseException" suspend_type="trace">
        <frame id="2198925348168" name="&lt;module&gt;" file="c%3A%5Cusers%5Ckanadig%5Csource%5Crepos%5Cpyscratch%5Cscratch%5Cscratch.py" line="1"></frame>
        <frame id="2198919847224" name="execfile" file="g%3A%5Cpyenv%5Ctest1%5Clib%5Csite-packages%5Cptvsd%5Cpydevd%5C_pydev_imps%5C_pydev_execfile.py" line="25"></frame>
        <frame id="2198914349528" name="run" file="g%3A%5Cpyenv%5Ctest1%5Clib%5Csite-packages%5Cptvsd%5Cpydevd%5Cpydevd.py" line="1036"></frame>
        <frame id="2198914771912" name="main" file="g%3A%5Cpyenv%5Ctest1%5Clib%5Csite-packages%5Cptvsd%5Cpydevd%5Cpydevd.py" line="1629"></frame>
        <frame id="2198919132472" name="debug" file="g%3A%5Cpyenv%5Ctest1%5Clib%5Csite-packages%5Cptvsd%5Cdebugger.py" line="36"></frame>
        <frame id="2198873179816" name="&lt;module&gt;" file="c%3A%5Cusers%5Ckanadig%5Cappdata%5Clocal%5Cmicrosoft%5Cvisualstudio%5C15.0_dcfc3d47exp%5Cextensions%5Cmicrosoft corporation%5Cpython%5C3.0%5Cptvsd_launcher.py" line="96"></frame>
    </thread>
</xml>
```


Resolving patch:
diff --git a/ptvsd/wrapper.py b/ptvsd/wrapper.py
--- a/ptvsd/wrapper.py
+++ b/ptvsd/wrapper.py
@@ -793,7 +793,10 @@ def on_exceptionInfo(self, request, args):
         # TODO: docstring
         tid = self.thread_map.to_pydevd(args['threadId'])
         with self.active_exceptions_lock:
-            exc = self.active_exceptions[tid]
+            try:
+                exc = self.active_exceptions[tid]
+            except KeyError:
+                exc = ExceptionInfo('BaseException', 'exception: no description')
         self.send_response(
             request,
             exceptionId=exc.name,


Test patch: