Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

fix(userSettings): Don't fail when user settings file is not a valid json #1059

Merged
merged 1 commit into from
Mar 12, 2018

Conversation

Fatme
Copy link
Contributor

@Fatme Fatme commented Mar 9, 2018

In case when user executes some command and by some reasons user settings file is not a valid json, {N} CLI throws "Unexpected token in JSON at position 0" error. After that user is not able to execute any cli command until the file exists.

NativeScript/nativescript-cli#3151

@Fatme
Copy link
Contributor Author

Fatme commented Mar 9, 2018

try {
this.userSettingsData = parseJson(data);
} catch (err) {
this.$logger.trace(`Error while trying to parseJson ${this.userSettingsFilePath} file.`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add the error in the message and the data as well.

@Fatme Fatme force-pushed the fatme/user-settings-file branch from 4c074aa to dd549da Compare March 9, 2018 11:57
…json

In case when user executes some command and by some reasons user settings file is not a valid json, {N} CLI throws "Unexpected token in JSON at position 0" error. After that user is not able to execute any cli command until the file exists.
@Fatme Fatme force-pushed the fatme/user-settings-file branch from dd549da to 506ee87 Compare March 12, 2018 13:20
@Fatme Fatme merged commit 325d7a1 into master Mar 12, 2018
@Fatme Fatme deleted the fatme/user-settings-file branch March 12, 2018 13:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants