Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Express Jade语法错误无法捕获_Express_Pug - Fatal编程技术网

Express Jade语法错误无法捕获

Express Jade语法错误无法捕获,express,pug,Express,Pug,最近我在一个网站上工作,使用expressJS和jade添加谷歌地图 我在jade中有一个“拼写”错误,无法正确加载谷歌地图(无显示) 没有在任何地方抛出错误,并且花了很多时间找出原因是丢失了一个字母“s”,从而阻止了贴图的渲染 有没有办法在jade中捕获所述错误? 我必须修改express 下面是我使用的jade文件 布局。jade !!! 5 html(lang='en') include includes/head body .wrapper include i

最近我在一个网站上工作,使用
expressJS
jade
添加谷歌地图
我在
jade
中有一个“拼写”错误,无法正确加载谷歌地图(无显示)

没有在任何地方抛出错误,并且花了很多时间找出原因是丢失了一个字母“s”,从而阻止了贴图的渲染

有没有办法在
jade
中捕获所述错误?
我必须修改
express

下面是我使用的
jade
文件

布局。jade

!!! 5
html(lang='en')
  include includes/head
  body
    .wrapper
      include includes/header
      block content
      include includes/footer
head
  meta(charset='UTF-8')
  title= title
  block stylesheets
    link(href='/site.css', rel='stylesheet', )
  block scripts
extends ../layout

append stylesheets
  style
    #Gmap{
      height: 400px;
      width: 760px;
    }
    etc...

append scripts
  script(src='http://maps.google.com/maps/api/js?sensor=false')
  etc ...
包括/head.jade

!!! 5
html(lang='en')
  include includes/head
  body
    .wrapper
      include includes/header
      block content
      include includes/footer
head
  meta(charset='UTF-8')
  title= title
  block stylesheets
    link(href='/site.css', rel='stylesheet', )
  block scripts
extends ../layout

append stylesheets
  style
    #Gmap{
      height: 400px;
      width: 760px;
    }
    etc...

append scripts
  script(src='http://maps.google.com/maps/api/js?sensor=false')
  etc ...
Gmap.jade

!!! 5
html(lang='en')
  include includes/head
  body
    .wrapper
      include includes/header
      block content
      include includes/footer
head
  meta(charset='UTF-8')
  title= title
  block stylesheets
    link(href='/site.css', rel='stylesheet', )
  block scripts
extends ../layout

append stylesheets
  style
    #Gmap{
      height: 400px;
      width: 760px;
    }
    etc...

append scripts
  script(src='http://maps.google.com/maps/api/js?sensor=false')
  etc ...
includes/head.jade
中有一个
块样式表

Gmap.jade
中调用
append样式表

样式表
被拼错为
样式表
,我花了很长时间才找到它。
没有抛出错误,网页在没有谷歌地图的情况下呈现“ok”

可以自定义
jade
/
express
以在不匹配时抛出错误吗?

(除了在写东西时更加小心之外。)

我有点困惑,你是说根本没有抛出错误?所以屏幕是完全空白的

您是否在服务器代码中使用了
express.errorHandler()
?您可以像这样设置错误消息

app.use( express.errorHandler({ dumpExceptions: true , showStack: true }) ))

这可能会解决您没有错误消息的问题。如果您想了解有关Express.js错误处理程序的更多信息,可以查看。Express只是Connect.js的包装器;这是底层代码。

如果你能找到答案,我很想知道答案。我还没有找到答案。我只是格外小心。如果他们有回应,我想我会发一个问题给他们,并发布一个答案。正如我在上面所说的,除了谷歌地图,一切都是“ok”的。没有抛出错误。我确实使用了
app.use(…