Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@foundry-ai/api-errors
Advanced tools
Common errors that can be thrown and caught reliably across services
Common errors that can be thrown and caught reliably across services
import { InternalError, NotFoundError } from '@foundry-ai/api-errors'
function doWork(callback) {
try {
performImpossibleTask(callback)
} catch {
throw new InternalError()
}
}
function findPuppy(puppyId, callback) {
queryForPuppy(puppyId, function(error, puppy) {
if (!puppy) throw new NotFoundError('failed to find puppy')
callback(puppy)
})
}
All Error classes can be instantiated with custom message
s and status
es
(given as parameters in that order), but come with sensible defaults.
Error Class | .message | .code | .type |
---|---|---|---|
BadRequestError | 'Bad Request' | 400 | 'bad_request_error' |
AuthenticationError | 'Unauthorized' | 401 | 'authentication_error' |
ForbiddenError | 'Forbidden' | 403 | 'forbidden_error' |
NotFoundError | 'Not Found' | 404 | 'not_found_error' |
ConflictError | 'Conflict' | 409 | 'conflict_error' |
RateLimitError | 'Too many requests' | 429 | 'rate_limit_error' |
InternalError | 'Internal Server Error' | 500 | 'internal_server_error' |
FAQs
Common errors that can be thrown and caught reliably across services
The npm package @foundry-ai/api-errors receives a total of 1 weekly downloads. As such, @foundry-ai/api-errors popularity was classified as not popular.
We found that @foundry-ai/api-errors 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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.