mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
Format code
This commit is contained in:
parent
71c9838008
commit
fd833216df
@ -32,9 +32,7 @@ const defaultTransition = <%=
|
||||
.replace('afterLeave(', 'function(').replace('leaveCancelled(', 'function(')
|
||||
%>
|
||||
|
||||
export { NuxtError }
|
||||
|
||||
export function createApp (ssrContext) {
|
||||
function createApp (ssrContext) {
|
||||
<% if (store) { %>
|
||||
const store = createStore()
|
||||
<% } %>
|
||||
@ -119,3 +117,5 @@ export function createApp (ssrContext) {
|
||||
|
||||
return { app, router<%= (store ? ', store' : '') %> }
|
||||
}
|
||||
|
||||
export { createApp, NuxtError }
|
||||
|
@ -101,18 +101,17 @@ export default function () {
|
||||
try {
|
||||
var { html, error } = yield self.renderRoute(route, { _generate: true })
|
||||
if(error) {
|
||||
errors.push({type : "handled", route, error})
|
||||
errors.push({ type : 'handled', route, error })
|
||||
}
|
||||
} catch(err) {
|
||||
errors.push({type : "unhandled", route, error : err})
|
||||
} catch (err) {
|
||||
errors.push({ type : 'unhandled', route, error: err })
|
||||
return
|
||||
|
||||
}
|
||||
try {
|
||||
var minifiedHtml = minify(html, self.options.generate.minify)
|
||||
} catch(err) {
|
||||
let minifyErr = new Error(`HTML minification failed. Make sure the route generates valid HTML. Failed HTML:\n ${html}`)
|
||||
errors.push({type : "unhandled", route, error : minifyErr})
|
||||
errors.push({ type : 'unhandled', route, error: minifyErr })
|
||||
return
|
||||
}
|
||||
var path = join(route, sep, 'index.html') // /about -> /about/index.html
|
||||
@ -136,15 +135,14 @@ export default function () {
|
||||
const duration = Math.round((Date.now() - s) / 100) / 10
|
||||
debug(`HTML Files generated in ${duration}s`)
|
||||
|
||||
if(errors.length) {
|
||||
console.error("==== Error report ==== \n" + errors.map( ({type, route, error}) => {
|
||||
if(type == "unhandled") {
|
||||
return `Route: '${route}'\n${error.stack}`
|
||||
} else {
|
||||
return `Route: '${route}' returned an error via context.error: \n` +
|
||||
JSON.stringify(error)
|
||||
}
|
||||
}).join("\n\n"))
|
||||
if (errors.length) {
|
||||
console.error('==== Error report ==== \n' + errors.map( ({type, route, error}) => {
|
||||
if(type === 'unhandled') {
|
||||
return `Route: '${route}'\n${error.stack}`
|
||||
} else {
|
||||
return `Route: '${route}' thrown an error: \n` + JSON.stringify(error)
|
||||
}
|
||||
}).join('\n\n'))
|
||||
}
|
||||
return this
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user