Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@sealsystems/assert-mongo-error
Advanced tools
Test for a servere mongodb error and handle it by exiting the process, throwing a new generated @sealsystems/error
error object or just ignore the error.
Default list of severe mongodb error codes to exit:
Name | Code |
---|---|
InternalError | 1 |
HostUnreachable | 6 |
HostNotFound | 7 |
NetworkTimeout | 89 |
SocketException | 9001 |
UnknownError | 8 |
ProtocolError | 17 |
IllegalOpMsgFlag | 223 |
UserNotFound | 11 |
Unauthorized | 13 |
AuthenticationFailed | 18 |
InvalidSSLConfiguration | 140 |
SSLHandshakeFailed | 141 |
OutOfDiskSpace | 14031 |
$ npm install @sealsystems/assert-mongo-error
First you need to add a reference to @sealsystems/assert-mongo-error within your application, then call the assert
function in the callback of every mongodb call.
const assertMongoError = require('@sealsystems/assert-mongo-error');
yourCollection.find({}, (findError, cursor) => {
assertMongoError.assert(findError);
...
});
Test for a servere mongodb error. The function has three outcomes:
@sealsystems/error
. The original mongodb error is chained to the new error.assertMongoError.assert(error, message, code, metadata);
Parameters:
error object mandatory The error object to test
message string optional Message used for creating a new error object
code number optional Code used for creating a new error object
metadata object optional Metadata used for creating a new error object
Use the setCodes
function to set a new list of error codes. This needs to be done only once, e.g. at startup. The new list is available instantly throughout the whole node process.
const assertMongoError = require('@sealsystems/assert-mongo-error');
assertMongoError.setCodes([1,2,3]);
...
assertMongoError.assert(mongoErrorObject);
To build this module use roboter.
$ bot
FAQs
Throws on a servere mongodb error.
The npm package @sealsystems/assert-mongo-error receives a total of 7 weekly downloads. As such, @sealsystems/assert-mongo-error popularity was classified as not popular.
We found that @sealsystems/assert-mongo-error demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.