Added stacktrace for sub-exceptions

Work in progress. Should fix #4224 

TODO:

- [ ] When there are sub-exceptions it's not clear which traces are for which exceptions.
- [ ] Adjust JavaScript to work with traces for multiple exceptions.
- [ ] Fix line-highlighting for sub-exceptions (currently it's slightly off).