Closed Bug 1056616 Opened 10 years ago Closed 10 years ago

Unify the use of JSON.parse and catch errors.

Categories

(Hello (Loop) :: Server, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: alexis+bugs, Assigned: rhubscher)

Details

(Whiteboard: [qa?])

Attachments

(1 file)

It looks like we have 12 instances (in 9 files) to JSON.parse() in this repo, ?q="JSON.parse"&type=Code

We'd probably want to wrap them all in try...catch blocks, or at least the ones not in the /test/ dir.

    /loop/encrypt.js:47
    /loop/fxa.js:27
    /loop/routes/calls.js:252
    /loop/storage/redis.js:141
    /loop/storage/redis.js:198
    /loop/websockets.js:358
    /test/functional_test.js:1178
    /test/middlewares_test.js:58
    /test/storage_test.js:236
    /test/storage_test.js:260
    /test/websockets_test.js:74
    /test/websockets_test.js:90
Whiteboard: [qa?]
I checked them and all of them are find:

 - For redis we are sure it is JSON 
 - For encrypt it is throwing an error handled later
 - For fxa, I have made a patch for it.
 - For calls it is a JSON.parse(JSON.stringify())
 - For tests we want the error to be thrown.
 - For websocket it is handled on the decode call.
Assignee: nobody → rhubscher
Status: NEW → ASSIGNED
Attachment #8479660 - Flags: review?(alexis+bugs)
Attachment #8479660 - Flags: review?(alexis+bugs) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: