Skip to content

Conversation

@GermanBluefox
Copy link
Contributor

Catch potential error in writeBaseSettings

Typing for writeBaseSettings/readbaseSettings added

Catch potential error in `writeBaseSettings`
} catch {
error = `Cannot write file ${configFile}`;
}
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This now overrides the error from "L2872" ... is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

error = `Cannot write file ${configFile}`;
}
} else if (!error) {
error = `Invalid data for writeBaseSettings ${msg.from}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm if we don't have an error yet we will always assign one here.. and the invalid data logged is the msg.from attribute? I think something is wrong here

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm okay the logic is okay as it only happens if config is falsy but shouldn't we log the received config then

}

try {
fs.writeFileSync(configFile, JSON.stringify(config, null, 2));

Check failure

Code scanning / CodeQL

Potential file system race condition High

The file may have changed since it
was checked
.
@foxriver76 foxriver76 merged commit 1ea0ace into master Sep 21, 2024
10 of 11 checks passed
@foxriver76 foxriver76 deleted the typing-main-914 branch September 21, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants