better error handling for safejsonparse