Closed mesalilac closed 2 years ago
@Senpai-10 Hi! Thank you for opening this issue and you are right, it didn't catch the error!
What do you suggest or how can we solve this problem? Thank you and BTW, we are open for PRs!
@JuanVqz alacrittyConfigPath function
returns undefined
if no alacritty configuration file is found, this is why
fs.readFileSync(alacrittyConfigPath(), 'utf8');
does not work
we can fix this is by checking if alacrittyConfigPath() return value
is not undefined
before trying to read from the file
Like this:
function getCurrentTheme() {
if (!alacrittyConfigPath()) {
console.log(
'No Alacritty configuration file found\nRun: `alacritty-themes -C` to create one'
);
exit(1);
}
const themeFile = fs.readFileSync(alacrittyConfigPath(), 'utf8');
const themeDoc = YAML.parse(themeFile);
return themeDoc.theme ? themeDoc.theme : 'default';
}
Describe the bug
'alacritty-themes' does not catch
readFileSync
error in line: https://github.com/rajasegar/alacritty-themes/blob/7679518e13d448b4f59495bbc5e95a8237196976/index.js#L48Error output:
To Reproduce
Steps to reproduce the behavior:
alacritty-themes --current