Skip to content

Commit

Permalink
fix: error friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
MHuiG committed Apr 17, 2022
1 parent 44e0e6f commit 3bffeab
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
6 changes: 3 additions & 3 deletions layout/_partial/scripts/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@

<%
if (theme.comments.service && theme.comments.service.length > 0) {
try {
partial('../../_plugins/comments/' + theme.comments.service + '/script')
} catch (e) {
try { %>
<%- partial('../../_plugins/comments/' + theme.comments.service + '/script') %>
<% } catch (e) {
// error friendly
console.log(`
===============================================================================
Expand Down
34 changes: 27 additions & 7 deletions layout/_plugins/_page_plugins/index.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
<%_(page.plugins||[]).forEach(function(item){ _%>
<%_if (typeof item == "string") { _%>
<%- partial( item + "/index") %>
<%_}else if(typeof item == "object"){ _%>
<%- partial( Object.keys(item)[0] + "/index", { pagePlugin:item }) %>
<%_} _%>
<%_ }) _%>
<%_
(page.plugins||[]).forEach(function(item){
try {
if (typeof item == "string") { _%>
<%- partial( item + "/index") %>
<%_ }else if(typeof item == "object"){ _%>
<%- partial( Object.keys(item)[0] + "/index", { pagePlugin:item }) %>
<%_ }
} catch (error) {
// error friendly
console.log(`
===============================================================================
没有找到页面插件:${item}
请检查是否存在该插件,或者检查插件名称是否正确:${item}
出问题的页面:${page.path}
see: https://volantis.js.org/v5/page-settings/#页面插件-page-plugins
================================================================================
There is no page plugin: ${item}
Please check if the plugin exists, or check the plugin name is correct: ${item}
The page that has problem: ${page.path}
see: https://volantis.js.org/v5/page-settings/#页面插件-page-plugins
=================================================================================`);
}
})
_%>

0 comments on commit 3bffeab

Please sign in to comment.