Changing the .surfbird file in different ways causes the app to throw different errors. We have to differentiate between two problems regarding this issue:
The content of the .surfbird file is not valid JSON.
The service object has missing/wrong data
Additional Information
Fixing the first point of the issue should be quite easy. If we take a look at the load()-method in the src/main/authentication/index.js file, we can see that the only safety check is if the file exists before parsing it to JSON. Maybe the the return of the JSON.parse function should be wrapped in a try-catch statement?
static load () {
let file = path.join(Authentication.homePath(), '.surfbird')
if (!fs.existsSync(file)) {
return null
}
return JSON.parse(fs.readFileSync(file, 'utf-8'))
}
For the second point we should maybe implement a check if the provided credentials are working and if not, ask the user to log in again to fix the file.
I guess we can implement multiple checks here. The one you noted, catching errors on load, and maybe another one for each client (checking if the object/keys are added properly, otherwise failing)
Description
Changing the .surfbird file in different ways causes the app to throw different errors. We have to differentiate between two problems regarding this issue:
Additional Information
Fixing the first point of the issue should be quite easy. If we take a look at the load()-method in the
src/main/authentication/index.js
file, we can see that the only safety check is if the file exists before parsing it to JSON. Maybe the the return of the JSON.parse function should be wrapped in a try-catch statement?For the second point we should maybe implement a check if the provided credentials are working and if not, ask the user to log in again to fix the file.