Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixture: add the process of throwing exceptions #2480

Merged
merged 1 commit into from
Sep 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ function fullBuild (opts) {

// Executes the build cycle for every locale.
fs.readdir(path.join(__dirname, 'locale'), (e, locales) => {
if (e) {
throw e;
}
const filteredLocales = locales.filter(file => junk.not(file) && (selectedLocales ? selectedLocales.includes(file) : true))
const localesData = generateLocalesData(filteredLocales)
filteredLocales.forEach((locale) => {
Expand Down
7 changes: 5 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ function getLocale (filePath) {
function dynamicallyBuildOnLanguages (source, locale) {
if (!selectedLocales || selectedLocales.length === 0) {
fs.readdir(path.join(__dirname, 'locale'), (e, locales) => {
if (e) {
throw e;
}
const filteredLocales = locales.filter(file => junk.not(file))
const localesData = build.generateLocalesData(filteredLocales)
build.buildLocale(source, locale, { preserveLocale, localesData })
Expand All @@ -68,7 +71,7 @@ build.getSource((err, source) => {
const locale = getLocale(filePath)

if (!selectedLocales || selectedLocales.includes(locale)) {
console.log(`The language ${locale} is changed, file is ${filePath}.`)
console.log(`The language ${locale} is changed, '${filePath}' is modified.`)
dynamicallyBuildOnLanguages(source, locale)
}
})
Expand All @@ -77,7 +80,7 @@ build.getSource((err, source) => {
const locale = getLocale(filePath)

if (!selectedLocales || selectedLocales.includes(locale)) {
console.log(`The language ${locale} is changed, file is ${filePath}.`)
console.log(`The language ${locale} is changed, '${filePath}' is added.`)
dynamicallyBuildOnLanguages(source, locale)
locales.add(filePath)
}
Expand Down