Skip to content

Commit c670a21

Browse files
committed
removed unnecessary try/catch
1 parent e0cc56d commit c670a21

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

src/ApiMailAdapter.js

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -414,37 +414,29 @@ class ApiMailAdapter extends MailAdapter {
414414
* if a localized file could not be determined.
415415
*/
416416
async _getLocalizedFilePath(filePath, locale) {
417-
try {
418-
// Get file name and base path
419-
const file = path.basename(filePath);
420-
const basePath = path.dirname(filePath);
421-
422-
// If locale is not set return default file
423-
if (!locale) { return filePath; }
417+
// Get file name and base path
418+
const file = path.basename(filePath);
419+
const basePath = path.dirname(filePath);
424420

425-
// Check file for locale exists
426-
const localePath = path.join(basePath, locale, file);
427-
const localeFileExists = await this._fileExists(localePath);
421+
// If locale is not set return default file
422+
if (!locale) { return filePath; }
428423

429-
// If file for locale exists return file
430-
if (localeFileExists) { return localePath; }
424+
// Check file for locale exists
425+
const localePath = path.join(basePath, locale, file);
426+
const localeFileExists = await this._fileExists(localePath);
431427

432-
// Check file for language exists
433-
const languagePath = path.join(basePath, locale.split("-")[0], file);
434-
const languageFileExists = await this._fileExists(languagePath);
428+
// If file for locale exists return file
429+
if (localeFileExists) { return localePath; }
435430

436-
// If file for language exists return file
437-
if (languageFileExists) { return languagePath; }
431+
// Check file for language exists
432+
const languagePath = path.join(basePath, locale.split("-")[0], file);
433+
const languageFileExists = await this._fileExists(languagePath);
438434

439-
// Return default file path
440-
return filePath;
435+
// If file for language exists return file
436+
if (languageFileExists) { return languagePath; }
441437

442-
} catch (e) {
443-
console.log("error in getLocalizedFilePath: " + e);
444-
445-
// Return default file path
446-
return filePath;
447-
}
438+
// Return default file path
439+
return filePath;
448440
}
449441

450442
/**

0 commit comments

Comments
 (0)