fix: report all build errors to the fcc console

Previously only challenges with previews would inform the user of syntax
errors.  This extends that to all challenges and corrects the output
format so errors are clearer.
This commit is contained in:
Oliver Eyton-Williams
2019-10-30 17:15:10 +01:00
committed by mrugesh
parent 890ce894cc
commit 5059d23600
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
.output-text {
white-space: pre-line;
white-space: pre-wrap;
word-break: normal;
padding-top: 0;
height: 100%;

View File

@ -125,13 +125,15 @@ function* previewChallengeSaga() {
return;
}
const challengeData = yield select(challengeDataSelector);
if (!challengeHasPreview(challengeData)) {
return;
}
try {
yield put(initConsole(''));
// try to build even if there's no preview so build errors will be reported.
const ctx = yield buildChallengeData(challengeData);
// then only continue if there is a preview.
if (!challengeHasPreview(challengeData)) {
return;
}
const document = yield getContext('document');
yield call(updatePreview, ctx, document);
} catch (err) {