Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@keepkey/errors
Advanced tools
This package contains named errors and a function to create new named errors
It's recommend to add this package to peerDependencies
to avoid duplicate versions of the package
which will cause instanceof
checks to fail.
import { ValidationError } from '@shapeshiftoss/errors'
throw new ValidationError('txId cannot be null', { details: { name: 'txId', expected: 'not null', actual: 'null' }})
import { createErrorClass } from '@shapeshiftoss/errors'
const MyError = createErrorClass<{ myDetails: string }>('MyError')
try {
throw new MyError('My cool error', { details: { myDetails: 'string' } })
} catch (e) {
assert.ok(e instanceof MyError)
}
All errors support a code
property. This property is designed to be used for internationalization
so that translated text can be displayed based on the code
rather than on the message
.
import { RateLimitError } from '@shapeshiftoss/errors'
const e = new RateLimitError('Something bad happened', { code: 'ERR_RATE_LIMIT_INFURA' })
ForbiddenError - Authorized but not allowed access request resource
NotFoundError - Can not find requested entity
RateLimitError - API returned a 429 error
UnauthorizedError - Trying to access a protected resource
ValidationError - Invalid data provided
FAQs
Common set of typed errors
The npm package @keepkey/errors receives a total of 0 weekly downloads. As such, @keepkey/errors popularity was classified as not popular.
We found that @keepkey/errors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.