Make errors more debuggable; capture correct stack, include name (#1944)

No more errors like this in the logs!

```
INFO  2018-01-05T18:33:15.942Z Message.saveErrors: null Error
    at file:///C:/Users/Test/AppData/Local/Programs/signal-desktop/resources/app.asar/js/libtextsecure.js:30:33
    at file:///C:/Users/Test/AppData/Local/Programs/signal-desktop/resources/app.asar/js/libtextsecure.js:138:3
    at file:///C:/Users/Test/AppData/Local/Programs/signal-desktop/resources/app.asar/js/libtextsecure.js:40718:3
```

It has no information in the title, and then the callstack points to
the `new Error()` line in the old `errors.js`.

This change will include the actual error name and message details in
the stack, and will include the original http error stack as well if
provided.
This commit is contained in:
Scott Nonnenberg 2018-01-08 11:08:25 -08:00 committed by GitHub
parent 94a8c7e524
commit 6464d0a5fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 164 additions and 100 deletions

View file

@ -34,6 +34,8 @@
<script type="text/javascript" src="../task_with_timeout.js" data-cover></script>
<script type="text/javascript" src="fake_api.js"></script>
<script type="text/javascript" src="errors_test.js"></script>
<script type="text/javascript" src="helpers_test.js"></script>
<script type="text/javascript" src="storage_test.js"></script>
<script type="text/javascript" src="crypto_test.js"></script>