kopia lustrzana https://github.com/c9/core
do not show ENOENT errors in browser console
rodzic
c7c3325a7c
commit
c044ca14f5
|
@ -10,6 +10,8 @@ module.exports = function setup(mount, vfs, mountOptions) {
|
|||
if (!mountOptions) mountOptions = {};
|
||||
|
||||
var errorHandler = mountOptions.errorHandler || function (req, res, err, code) {
|
||||
// do not show ENOENT errors in browser console
|
||||
if (err.code != "ENOENT")
|
||||
console.error(err.stack || err);
|
||||
if (res.headersSent) {
|
||||
res.end("");
|
||||
|
@ -20,7 +22,7 @@ module.exports = function setup(mount, vfs, mountOptions) {
|
|||
else if (typeof err.code == "number" && isValidStatusCode(err.code)) res.statusCode = err.code;
|
||||
else if (err.code === "EBADREQUEST") res.statusCode = 400;
|
||||
else if (err.code === "EACCES") res.statusCode = 403;
|
||||
else if (err.code === "ENOENT") res.statusCode = 404;
|
||||
else if (err.code === "ENOENT") res.statusCode = 208;
|
||||
else if (err.code === "ENOTREADY") res.statusCode = 503;
|
||||
else if (err.code === "EISDIR") res.statusCode = 503;
|
||||
else res.statusCode = 500;
|
||||
|
|
|
@ -119,11 +119,11 @@ define(function(require, module, exports) {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.status > 299) {
|
||||
if (xhr.status > 299 || xhr.status == 208) {
|
||||
var err = new Error(xhr.responseText);
|
||||
err.code = xhr.status;
|
||||
if (debug)
|
||||
console.error("HTTP error " + this.status + ": " + xhr.responseText);
|
||||
if (debug && xhr.status > 299)
|
||||
console.error("HTTP error " + xhr.status + ": " + xhr.responseText);
|
||||
return done(err, data, res);
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue