![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
If you've written Node, you've written this:
doSomething((error, data) => {
if (error) {
// handle error
} else {
// handle data
}
});
With Blooper, you write one error handler, and your code looks like this:
doSomething((error, data) => {
blooper.handle(error).then(() => {
// handle data
});
});
This makes it easy to surface errors in the UI, log them and continue, or crash when appropriate.
There are three things to know:
require
it and pass it an error handler.handle
method which will resolve a promise if the error is falsy, or else handle the error.attempt
method that wraps try-catch (see below).let response;
const http = require('http'),
blooper = require('blooper')((error, status = 500) => {
// Put your error handling logic here
console.error(error);
response.writeHead(status, 'text/html; charset=UTF-8');
response.end(error.stack || error);
});
http.createServer((req, res) => {
response = res;
doSomething((err, data) => {
blooper.handle(err).then(() => {
// use data
});
});
// You can wrap try/catch too!
// By default, Blooper will catch using your error handler
blooper.attempt(() => {
doSomethingDangerous();
});
// Or you can pass a custom catcher
blooper.attempt(() => {
doSomethingDangerous();
}, err => {
// handle error here
});
}).listen(3000);
The above examples only work because Blooper is configured in the same file that accepts requests. In order to use Blooper in other modules in your app, you need to give it access to the res
object (assuming your error handler sends responses sometimes). For that, you have two options:
Most apps pass around the request object already, so you can stick Blooper on there.
let response;
const http = require('http'),
blooper = require('blooper')((error, status = 500) => {
// Put your error handling logic here
console.error(error);
response.writeHead(status, 'text/html; charset=UTF-8');
response.end(error.stack || error);
}),
doSomething = require('./doSomething');
http.createServer((req, res) => {
response = res;
req.blooper = blooper;
doSomething(req);
}).listen(3000);
Globals are generally a last resort, but I'll let you make an exception for Blooper, since it's really intended to be global in nature - its use is to replace language constructs, after all.
let response;
const http = require('http'),
blooper = require('blooper')((error, status = 500) => {
// Put your error handling logic here
console.error(error);
response.writeHead(status, 'text/html; charset=UTF-8');
response.end(error.stack || error);
});
// This makes the global.handle method available in all modules
global.handle = blooper.handle;
http.createServer((req, res) => {
// ...
}).listen(3000);
FAQs
Handle all your errors in one place.
We found that blooper demonstrated a not healthy version release cadence and project activity because the last version was released 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.