feat(errors): new error page copy

This commit is contained in:
Benedikt Rötsch
2018-02-14 16:15:32 +01:00
committed by Benedikt Rötsch
parent 3c9089af98
commit 5e55d7b5b4
5 changed files with 47 additions and 47 deletions

2
app.js
View File

@@ -136,7 +136,7 @@ app.use('/', routes)
// Catch 404 and forward to error handler
app.use(function (request, response, next) {
const err = new Error(translate('error404Route', response.currentLocale))
const err = new Error(translate('errorMessage404Route', response.currentLocale))
err.status = 404
next(err)
})

View File

@@ -60,15 +60,6 @@
"startCourseLabel": "Kurs beginnen",
"categoriesLabel": "Kategorien",
"allCoursesLabel": "Alle Kurse",
"somethingWentWrongLabel": "Hmm, etwas ging schief.",
"tryLabel": "Versuchen Sie",
"contentModelChangedErrorLabel": "Überprüfen Sie, ob das Content Model verändert wurde.",
"draftOrPublishedErrorLabel": "Überprüfen Sie, ob es nicht veröffentlichte Änderungen gibt.",
"localeContentErrorLabel": "Überprüfen Sie, ob es Inhalt für diese Sprache gibt.",
"verifyCredentialsErrorLabel": "Überprüfen Sie, ob die Zugangsdaten richtig und nicht abgelaufen sind.",
"stackTraceErrorLabel": "Schauen Sie sich den folgenden Stack Trace an",
"errorLabel": "Fehler",
"stackTraceLabel": "Stack Trace",
"companyLabel": "Firma",
"officeLabel": "Büro in Berlin",
"germanyLabel": "Deutschland",
@@ -114,10 +105,19 @@
"usingServerCredentialsLabel": "Die Beispielanwendung verwendet derzeit serverseitig gespeicherte Anmeldeinformationen zum Herstellen einer Verbindung mit einem Contentful-Space.",
"usingSessionCredentialsLabel": "Die Beispielanwendung verwendet derzeit Anmeldeinformationen von der Anwendungssitzung, um eine Verbindung zu einem Contentful-Space herzustellen.",
"applicationCredentialsLabel": "Anmeldeinformationen für die Anwendungssitzung",
"notFoundErrorLabel": "Diese Seite kann nicht gefunden werden. Stellen Sie sicher, dass sie existiert und veröffentlicht ist.",
"error404Route": "Vergewissern Sie sich, dass sie eine unterstützte Adresse aufrufen.",
"error404Lesson": "Vergewissern Sie sich, dass die Lektion veröffentlicht ist und nicht gelöscht wurde.",
"error404Course": "Vergewissern Sie sich, dass der Kurs veröffentlicht ist und nicht gelöscht wurde.",
"error404Category": "Vergewissern Sie sich, dass die Kategorie veröffentlicht ist und nicht gelöscht wurde.",
"errorHighlightedCourse": "⚠️ Dieser Kurs wurde nicht veröffentlicht oder existiert nicht"
"errorHighlightedCourse": "⚠️ Dieser Kurs wurde nicht veröffentlicht oder existiert nicht.",
"somethingWentWrongLabel": "Hmm, etwas ging schief.",
"errorMessage404Route": "Diese Seite existiert nicht.",
"errorMessage404Lesson": "Diese Lektion existiert nicht.",
"errorMessage404Course": "Dieser Kurs existiert nicht.",
"errorMessage404Category": "Diese Kategorie existiert nicht.",
"hintsLabel": "Versuchen Sie Folgendes um die Probleme zu lösen:",
"notFoundErrorHint": "Überprüfen Sie, ob dieser Inhalt existiert und veröffentlicht wurde.",
"contentModelChangedErrorHint": "Überprüfen Sie, ob die Struktur der Inhalte geändert wurde. Haben Sie einen Inhaltstyp oder ein benötigtes Feld gelöscht?",
"draftOrPublishedErrorHint": "Überprüfen Sie, ob der Inhalt veröffentlicht wurde, Änderungen enthält (Content Delivery API) oder gelöscht wurde (Content Preview API & Content Delivery API).",
"localeContentErrorHint": "Überprüfen Sie, ob alle benötigten Felder dieser Sprache befüllt wurden.",
"verifyCredentialsErrorHint": "Überprüfen Sie, ob die Space ID und die Access Tokens richtig und nicht abgelaufen sind.",
"stackTraceErrorHint": "Schauen Sie sich den folgenden Stack Trace an.",
"errorLabel": "Fehler von Contentful:",
"stackTraceLabel": "Stack trace:"
}

View File

@@ -60,15 +60,6 @@
"startCourseLabel": "Start course",
"categoriesLabel": "Categories",
"allCoursesLabel": "All courses",
"somethingWentWrongLabel": "Oops, something went wrong",
"tryLabel": "Try",
"contentModelChangedErrorLabel": "Check if the content model has changed",
"draftOrPublishedErrorLabel": "Check the selection has content in draft or published state (for Preview or Delivery)",
"localeContentErrorLabel": "Check if there's any content for this locale",
"verifyCredentialsErrorLabel": "Verify credentials are correct and up to date",
"stackTraceErrorLabel": "Check the stack trace below",
"errorLabel": "Error",
"stackTraceLabel": "Stack trace",
"companyLabel": "Company",
"officeLabel": "Office Berlin",
"germanyLabel": "Germany",
@@ -114,10 +105,19 @@
"usingServerCredentialsLabel": "The example app is currently using server side stored credentials to connect to a Contentful space.",
"usingSessionCredentialsLabel": "The example app is currently using application session stored credentials to connect to a Contentful space.",
"applicationCredentialsLabel": "Application session credentials",
"notFoundErrorLabel": "The page you are trying to access could not be found. Make sure it is existing and published.",
"error404Route": "Make sure that you are trying to reach a supported address.",
"error404Lesson": "Make sure that the lesson has not been deleted or unpublished.",
"error404Course": "Make sure that the course has not been deleted or unpublished.",
"error404Category": "Make sure that the category has not been deleted or unpublished.",
"errorHighlightedCourse": "⚠️ The course is not published or does not exist"
"errorHighlightedCourse": "⚠️ The course is not published or does not exist.",
"somethingWentWrongLabel": "Oops, something went wrong",
"errorMessage404Route": "The page you are trying to open does not exist.",
"errorMessage404Lesson": "The lesson you are trying to open does not exist.",
"errorMessage404Course": "The course you are trying to open does not exist.",
"errorMessage404Category": "The category you are trying to open does not exist.",
"hintsLabel": "Try the following to fix the issue(s):",
"notFoundErrorHint": "Make sure the content you are trying to access exists and is published.",
"contentModelChangedErrorHint": "Check if the content model has changed. Did you delete a content type or a required field?",
"draftOrPublishedErrorHint": "Check if the content is in a draft or pending changes state (Content Delivery API), or if it has been deleted (Content Preview API & Content Delivery API).",
"localeContentErrorHint": "Check if all required fields have content for this locale.",
"verifyCredentialsErrorHint": "Verify that your space id and access tokens are correct and up to date.",
"stackTraceErrorHint": "Check the stack trace below.",
"errorLabel": "Error from Contentful:",
"stackTraceLabel": "Stack trace:"
}

View File

@@ -57,7 +57,7 @@ module.exports.getCourse = async (request, response, next) => {
course = await getCourse(request.params.slug, response.locals.currentLocale.code, response.locals.currentApi.id)
} catch (err) {
if (err.status === 404) {
err.message = translate('error404Course', response.currentLocale)
err.message = translate('errorMessage404Course', response.currentLocale)
}
throw err
}
@@ -98,7 +98,7 @@ module.exports.getCoursesByCategory = async (request, response, next) => {
const activeCategory = categories.find((category) => category.fields.slug === request.params.category)
if (!activeCategory) {
const error = new Error(translate('error404Category', response.currentLocale))
const error = new Error(translate('errorMessage404Category', response.currentLocale))
error.status = 404
throw error
}
@@ -128,7 +128,7 @@ module.exports.getLesson = async (request, response, next) => {
let {lesson, nextLesson} = getNextLesson(lessons, request.params.lslug)
if (!lesson) {
const error = new Error(translate('error404Lesson', response.currentLocale))
const error = new Error(translate('errorMessage404Lesson', response.currentLocale))
error.status = 404
throw error
}

View File

@@ -6,24 +6,24 @@ block content
.layout-centered
.error
h1 #{translate('somethingWentWrongLabel', currentLocale.code)} (#{error.status})
p #{error.message}
// We use the last line to have a human readable output for pug error messages
p #{error.message.split('\n').pop()}
h2 #{translate('tryLabel', currentLocale.code)}:
h2 #{translate('hintsLabel', currentLocale.code)}
ul
case error.status
when 404
li #{translate('notFoundErrorLabel', currentLocale.code)}
li #{translate('draftOrPublishedErrorLabel', currentLocale.code)}
li #{translate('notFoundErrorHint', currentLocale.code)}
li #{translate('draftOrPublishedErrorHint', currentLocale.code)}
when 400
li #{translate('contentModelChangedErrorLabel', currentLocale.code)}
when 401
li #{translate('verifyCredentialsErrorLabel', currentLocale.code)}
li #{translate('localeContentErrorLabel', currentLocale.code)}
when 500
li #{translate('contentModelChangedErrorLabel', currentLocale.code)}
li #{translate('contentModelChangedErrorHint', currentLocale.code)}
default
li #{translate('contentModelChangedErrorHint', currentLocale.code)}
li #{translate('draftOrPublishedErrorHint', currentLocale.code)}
li #{translate('localeContentErrorHint', currentLocale.code)}
if error.stack
li #{translate('stackTraceErrorLabel', currentLocale.code)}
li #{translate('stackTraceErrorHint', currentLocale.code)}
if helpers.isCustomCredentials(settings)
form(action='/settings?reset=true' method='POST')