Trên GitHub, petkaantonov/core-error-predicates đã đạt 31 sao, ngôn ngữ JavaScript. Error predicate functions for operational errors thrown by node core.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Error predicate functions for operational errors thrown by node core.
Predicate functions take an error object as argument and return true if the error object matches. This useful for instance when using bluebird catch filters or in the future when the JavaScript catch clauses will be able to take filter/predicate function parameters.
Example using bluebird:
require("core-error-predicates").globalize();
fs.readFileAsync("test.txt", "utf8").then(function(contents) {
console.log("file contents:", contents);
})
.catch(FileNotFoundError, function(e) {
console.log("file test.txt does not exist");
})
.catch(FileAccessError, function(e) {
console.log("no permissions to access test.txt");
});
#API
The module exports various error predicates and the .globalize() method.
The .globalize() method makes all the predicate functions available in global scope for convenience. If the name is already taken for a predicate in global scope, it will not be overwritten.
Predicates can be turned into instances of their error types by using the new operator:
try {
throw new FileNotFoundError("A file was not found!");
}
catch (e) {
assert(FileNotFoundError(e) === true);
}
##Error predicates
FileNotFoundError
FileAccessError
EOFError
UnknownHostError
SocketError
ProtocolError
FileSystemError
ConnectError
BindError
AddressNotFoundError
NetworkError
SSLError
#####FileNotFoundError
When the error's code matches one of:
ENOENT
#####FileAccessError
When the error's code matches one of:
EACCES
EPERM
#####EOFError
When the error's code matches one of:
EOF
#####UnknownHostError
When the error's code matches one of:
EADDRINFO
#####SocketError
When the error's code matches one of:
EISCONN
ENOTCONN
ENOTSOCK
ENOTSUP
EPROTOTYPE
EAIFAMNOSUPPORT
EAISERVICE
#####ProtocolError
When the error's code matches one of:
EPROTO
EPROTONOSUPPORT
EPROTOTYPE
#####FileSystemError
When the error's code matches one of:
EBUSY
ENOENT
EOF
EACCES
EAGAIN
EBADF
EMFILE
ENOTDIR
EISDIR
EEXIST
ENAMETOOLONG
EPERM
ELOOP
ENOTEMPTY
ENOSPC
EIO
EROFS
ENODEV
ESPIPE
ECANCELED
ENFILE
EXDEV
#####ConnectError
When the error's code matches one of:
ECONNABORTED
ECONNREFUSED
ECONNRESET
ETIMEDOUT
#####BindError
When the error's code matches one of:
EADDRNOTAVAIL
#####AddressNotFoundError
When the error's code matches one of:
ENOTFOUND
#####NetworkError
When the error's code matches one of:
EADDRINFO
EADDRNOTAVAIL
EAFNOSUPPORT
EALREADY
ECONNABORTED
ECONNREFUSED
ECONNRESET
EDESTADDRREQ
EHOSTUNREACH
EISCONN
EMSGSIZE
ENETDOWN
ENETUNREACH
ENONET
ENOTCONN
ENOTSOCK
ENOTSUP
EPIPE
EPROTO
EPROTONOSUPPORT
EPROTOTYPE
ETIMEDOUT
EAIFAMNOSUPPORT
EAISERVICE
EAISOCKTYPE
ESHUTDOWN
ENOTFOUND
#####SSLError
When the error's message begins with "SSL Error:".
#License
The MIT License (MIT)
Copyright (c) 2015 Petka Antonov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
petkaantonov/core-error-predicates có bao nhiêu sao?
petkaantonov/core-error-predicates có 31 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/petkaantonov/core-error-predicates. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
petkaantonov/core-error-predicates có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho petkaantonov/core-error-predicates. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
petkaantonov/core-error-predicates còn đang phát triển không?
Commit gần nhất trên petkaantonov/core-error-predicates là 7.0 năm trước (theo timestamp GitHub). Repo có 3 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
petkaantonov/core-error-predicates là gì?
petkaantonov/core-error-predicates (petkaantonov/core-error-predicates) là dự án JavaScript trên GitHub. Theo mô tả gốc: Error predicate functions for operational errors thrown by node core.
petkaantonov/core-error-predicates viết bằng ngôn ngữ gì?
petkaantonov/core-error-predicates chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về core-error-predicates?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về core-error-predicates.