Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper rejection
Message
De
25/08/2017 05:40:38
 
 
Information générale
Forum:
AngularJS
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01653655
Message ID:
01653740
Vues:
36
This message has been marked as a message which has helped to the initial question of the thread.
J'aime (1)
>>Take your pick or make up your own - angular $http (in 1.x - not 2) regards any Http status code outside of 200-299 range as being an error ......
>>
>>>
>
>There are the errors
>
>http://www.restapitutorial.com/httpstatuscodes.html
>
>Which one can I use?

If the only consumer of the $http call will be your own browser code then you could pick any (maybe 418 or 420 :-} ) - or even define your own codes for the errors that are caught.
You could define and document a whole bunch of custom status codes specific to the application. Or pick one code and include more specific information in the response body.....


If the call may be made by other clients then it's a question of picking the best fit - if the error is in the client request then pick one of the 400 codes; if on the server then 5xx....

Good decision tree for Rest error codes here : http://racksburg.com/choosing-an-http-status-code/
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform