Skip to content

Commit c8280c8

Browse files
committed
publish: change (file watcher) handle 404 errors
1 parent 45ecaed commit c8280c8

File tree

9 files changed

+422
-771
lines changed

9 files changed

+422
-771
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "includejs",
3-
"version": "0.16.2",
3+
"version": "0.16.3",
44
"homepage": "https://github.com/atmajs/IncludeJS",
55
"authors": [
66
"Alex Kit <[email protected]>"

lib/include.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,9 @@ function bin_removeDelegate(url) {
805805
// use timeout as sys-file-change event is called twice
806806
var timeout;
807807
return function () {
808-
if (timeout)
808+
if (timeout) {
809809
clearTimeout(timeout);
810+
}
810811
timeout = setTimeout(function () {
811812
bin_tryReload(url, function () {
812813
Config_1.cfg.autoreload && Config_1.cfg.autoreload.fileChanged(url, 'include');

lib/include.module.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,9 @@ function bin_removeDelegate(url) {
800800
// use timeout as sys-file-change event is called twice
801801
var timeout;
802802
return function () {
803-
if (timeout)
803+
if (timeout) {
804804
clearTimeout(timeout);
805+
}
805806
timeout = setTimeout(function () {
806807
bin_tryReload(url, function () {
807808
Config_1.cfg.autoreload && Config_1.cfg.autoreload.fileChanged(url, 'include');

lib/include.node.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,8 +1190,9 @@ function bin_removeDelegate(url) {
11901190
// use timeout as sys-file-change event is called twice
11911191
var timeout;
11921192
return function () {
1193-
if (timeout)
1193+
if (timeout) {
11941194
clearTimeout(timeout);
1195+
}
11951196
timeout = setTimeout(function () {
11961197
bin_tryReload(url, function () {
11971198
Config_1.cfg.autoreload && Config_1.cfg.autoreload.fileChanged(url, 'include');
@@ -4081,7 +4082,12 @@ function readWithAtmaIo(File, url, callback) {
40814082
function file_watch(url, callback) {
40824083
url = toSystemPath(url);
40834084
_unbind(url);
4084-
_watchers[url] = _fs.watch(url, callback);
4085+
try {
4086+
_watchers[url] = _fs.watch(url, callback);
4087+
}
4088+
catch (error) {
4089+
console.warn("Tried to watch the file ".concat(url, ": ").concat(error.message));
4090+
}
40854091
}
40864092
exports.file_watch = file_watch;
40874093
;

lib/include.node.module.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,8 +1185,9 @@ function bin_removeDelegate(url) {
11851185
// use timeout as sys-file-change event is called twice
11861186
var timeout;
11871187
return function () {
1188-
if (timeout)
1188+
if (timeout) {
11891189
clearTimeout(timeout);
1190+
}
11901191
timeout = setTimeout(function () {
11911192
bin_tryReload(url, function () {
11921193
Config_1.cfg.autoreload && Config_1.cfg.autoreload.fileChanged(url, 'include');
@@ -4076,7 +4077,12 @@ function readWithAtmaIo(File, url, callback) {
40764077
function file_watch(url, callback) {
40774078
url = toSystemPath(url);
40784079
_unbind(url);
4079-
_watchers[url] = _fs.watch(url, callback);
4080+
try {
4081+
_watchers[url] = _fs.watch(url, callback);
4082+
}
4083+
catch (error) {
4084+
console.warn("Tried to watch the file ".concat(url, ": ").concat(error.message));
4085+
}
40804086
}
40814087
exports.file_watch = file_watch;
40824088
;

0 commit comments

Comments
 (0)