![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.
angular-errorz
Advanced tools
An error handling service for AngularJS
AngularJS ~1.2 is required
npm install angular-errorz
var exampleApp = angular.module("exampleApp", ["ttErrorz"]);
Configure the service within your app module's run block:
exampleApp.run(["errorz", function (errorz) {
errorz.addHandler(/* see Examples */);
}]);
addHandler(status, handler)
Add a handler for an HTTP status code
Param | Type | Details |
---|---|---|
status | Number | The HTTP status code to handle. |
handler | Function | The function the service should call when handling the specified HTTP status code. |
errorz
: for chaining.
addBatch(statuses, handler)
Add a handler for multiple HTTP status codes
Name | Type | Details |
---|---|---|
statuses | Array | The HTTP status codes to handle. |
handler | Function | The function the service should call when handling the specified HTTP status codes. |
errorz
: for chaining.
handled(status)
Determines whether the service has been configured to handle the specified status
Param | Type | Details |
---|---|---|
status | Number | The HTTP status code to check. |
Boolean
: true when the service contains a handler for the specified status.
statusCodes()
Gets the list of HTTP status codes the service has been configured to handle.
None
Array[String]
: an array of HTTP status codes.
Name | Type | Details |
---|---|---|
floodControl.threshold | Number | The number of milliseconds the service will wait before calling handlers for identical HTTP status codes. Setting this to undefined , null , or 0 will disable Flood Control. Defaults to 1000. |
Capture HTTP status code 500, and output the error to the browser's console.
errorz.addHandler(500, function (rejection) {
console.error("Please try again.", "Server Error 500");
});
Capture HTTP status codes: -1, 0, 500, using the same handler for all of them. Outputting the error to the browser's console.
errorz.addBatch([-1, 0, 500], function (rejection) {
console.error("Please try again.", "Server Error " + rejection.status);
});
You can do the same thing with multiple calls to addHandler
instead of addBatch
. Impractical, for this use case, but here it is for demonstrative purposes:
errorz.addHandler(-1, handler)
.addHandler(0, handler)
.addHandler(500, handler);
var handler = function (rejection) {
console.error("Please try again.", "Server Error " + rejection.status);
};
Similar to Example 2, but handle HTTP status code 404 conditionally within the same handler.
errorz.addBatch([-1, 0, 404, 500], function (rejection) {
rejection.status === 404 && console.warn(rejection.config.url, "404 Not Found")
|| console.error("Please try again.", "Server Error " + rejection.status);
});
Effectively the same end result as Example 3, just spread out.
errorz.addBatch([-1, 0, 500], function (rejection) {
console.error("Please try again.", "Server Error " + rejection.status);
});
Then, elsewhere/elsewhile...
errorz.addHandler(404, function(rejection) {
console.warn(rejection.config.url, "404 Not Found");
});
Same as Example 3, but notify the user with toastr instead of logging to the console. We also enable flood control with a threshold equal to toastr's timeout, to prevent spamming the user with toast when there is a flood of identical errors.
errorz.addBatch([-1, 0, 404, 500], function (rejection) {
rejection.status === 404 && toastr.warning(rejection.config.url, "404 Not Found")
|| toastr.error("Please try again.", "Server Error " + rejection.status);
}).floodControl.threshold = +toastr.options.timeOut;
FAQs
An error handling service for AngularJS
The npm package angular-errorz receives a total of 3 weekly downloads. As such, angular-errorz popularity was classified as not popular.
We found that angular-errorz 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.