diff --git a/templates/docs/javascript.html b/templates/docs/javascript.html
index 012b64ae..03a4ae26 100644
--- a/templates/docs/javascript.html
+++ b/templates/docs/javascript.html
@@ -1,7 +1,9 @@
Javascript
Below is an example of making a HTTP request to SITE_NAME from Node.js.
var https = require('https');
-https.get("PING_URL");
+https.get('PING_URL').on('error', (err) => {
+ console.log('Ping failed: ' + err)
+});
diff --git a/templates/docs/javascript.md b/templates/docs/javascript.md
index 28881533..d30dfedc 100644
--- a/templates/docs/javascript.md
+++ b/templates/docs/javascript.md
@@ -4,7 +4,9 @@ Below is an example of making a HTTP request to SITE_NAME from Node.js.
```js
var https = require('https');
-https.get("PING_URL");
+https.get('PING_URL').on('error', (err) => {
+ console.log('Ping failed: ' + err)
+});
```
You can also send pings from a browser environment. SITE_NAME sets the
diff --git a/templates/front/snippets/node.html b/templates/front/snippets/node.html
index fa2eb4d7..76b6b8ec 100644
--- a/templates/front/snippets/node.html
+++ b/templates/front/snippets/node.html
@@ -1,3 +1,5 @@
var https = require('https');
-https.get("{{ ping_url }}");
+https.get('{{ ping_url }}').on('error', (err) => {
+ console.log('Ping failed: ' + err)
+});
diff --git a/templates/front/snippets/node.txt b/templates/front/snippets/node.txt
index 5728ac5b..7398a390 100644
--- a/templates/front/snippets/node.txt
+++ b/templates/front/snippets/node.txt
@@ -1,2 +1,4 @@
var https = require('https');
-https.get("PING_URL");
+https.get('PING_URL').on('error', (err) => {
+ console.log('Ping failed: ' + err)
+});
\ No newline at end of file