Fixes to error handling in persistence JS.