[nostory] mitigate funky stuff w.r.t. safety number changes
on 10/1/2019 - 10/3/2019, we observed some funny errors (including halting errors) after merging #100 (closed) (which introduced changed safety number handling)
symptoms:
- lots of log statements with undefined values (traceable to
logAndReturn
statements having unexpected shapes after calls to trust safety numbers) - calls to JSON.parse in safety number changing code in the signal service throwing unexpectedly
rather than provide a full fix for the bug, this MR introduces some instrumentation to help better diagnose the problem, and -- in the meantime -- prevent it from crashing the app.
more specifically it:
- introduces more robust
logAndReturn
statements that will show us whatever is happening around safety number change results - introduces a safer implementation of
JSON.parse
that will reject a Promise (which itself should be caught and logged) if message parsing ever fails