fix(templates): Handle error when scanning dir (Sentry 44351)

https://sentry.nylas.com/sentry/edgehill/group/44351/
This commit is contained in:
Ben Gotow 2016-10-04 13:59:04 -07:00
parent 4160757c9e
commit e57fd2c678

View file

@ -90,6 +90,13 @@ class TemplateStore extends NylasStore {
_populate() {
fs.readdir(this._templatesDir, (err, filenames) => {
if (err) {
NylasEnv.showErrorDialog({
title: "Cannot scan templates directory",
message: `N1 was unable to read the contents of your templates directory (${this._templatesDir}). You may want to delete this folder or ensure filesystem permissions are set correctly.`,
});
return;
}
this._items = [];
for (let i = 0, filename; i < filenames.length; i++) {
filename = filenames[i];