
Security News
RubyGems Adds Cooldown Feature to Bundler for Newly Published Gems
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.
@fortify-ts/fallback
Advanced tools
Fallback pattern for the Fortify-TS resilience library.
npm install @fortify-ts/fallback
# or
pnpm add @fortify-ts/fallback
shouldFallback callbackonFallback and onSuccess callbacksimport { Fallback } from '@fortify-ts/fallback';
const fallback = new Fallback<User>({
fallback: () => ({ id: 0, name: 'Guest' }),
});
// Returns Guest user if operation fails
const user = await fallback.execute(async (signal) => {
return fetchUser(userId, { signal });
});
const fallback = new Fallback<Response>({
fallback: (error) => {
console.log(`Falling back due to: ${error.message}`);
return cachedResponse;
},
});
const fallback = new Fallback<Response>({
fallback: () => defaultResponse,
// Only fallback on network errors
shouldFallback: (error) => {
return error instanceof NetworkError;
},
});
const fallback = new Fallback<Data>({
// Fallback function (required)
fallback: (error) => defaultData,
// Custom fallback condition
shouldFallback: (error) => error instanceof NetworkError,
// Notification on fallback
onFallback: (error) => {
metrics.increment('fallback.activated');
},
// Notification on success
onSuccess: (result) => {
metrics.increment('primary.success');
},
// Optional logger
logger: myLogger,
});
const fallback = new Fallback<Data>({
fallback: async (error) => {
// Fallback to cache
return await cache.get('backup-data');
},
});
| Option | Type | Default | Description |
|---|---|---|---|
fallback | function | required | Fallback function |
shouldFallback | function | - | Custom condition |
onFallback | function | - | Fallback callback |
onSuccess | function | - | Success callback |
logger | FortifyLogger | - | Optional logger |
MIT
FAQs
Fallback pattern for graceful degradation in @fortify-ts
The npm package @fortify-ts/fallback receives a total of 11 weekly downloads. As such, @fortify-ts/fallback popularity was classified as not popular.
We found that @fortify-ts/fallback demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.