Rule Definition
Ensure that each web service callback is going to be properly checked in order to make sure you will not miss any problem that occurred in your application and you will give the information to the user.
Remediation
Use then() or catch() instead of success() or error()
Violation Code Sample
$http.get('api/data').success(function onSuccess() {
// ...
}); // error: $http success is deprecated. Use then instead
// invalid
$http.get('api/data').error(function onReject() {
// ...
}); // error: $http error is deprecated. Use then or catch instead
Fixed Code Sample
$http.get('api/data').then(function onSuccess() {
// ...
}, function onReject() {
// ...
});
Reference
CISQ OMG
https://github.com/Gillespie59/eslint-plugin-angular/blob/master/docs/no-http-callback.md
Related Technologies
Technical Criterion
CWE-396 - Declaration of Catch for Generic Exception
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.