22.8.18

API Exceptions





API Exceptions:-





Client Errors:-
a.     400 :-  Bad Request (When request is not understood by the server)
Example:-
Actual Payload:-
{"ContainerKey":"ND1","ContainerName":"ND1","OrganizationKey":"uddi:c1342b42-6b3c-11e6-b3f3-c019807079e9","ContainerDescription":"ND111"}





sent request in an invalid format. Requests were failed with 400 – bad request.

                                        (or)
Invalid media type selected in payload





b.     401 :- Unauthorized (When api/service is called by the unauthorized user)

Api has authentication policy. but called the api with blank credentials.

C.     404 :-  Service is unavailable (Service is unavailable/When api about to start)


D.     405 – Request with an invalid path parameter.
Request with an invalid path parameter.




a.     415 :- Unsupported Media Type (does not agree with the media type specified on the request / is incompatible with the current data for the resource/ is incompatible with the HTTP method specified on the request) 

b.     408:- Request Timeout (The server timed out waiting for the request. i.e The client failed to send a request in the time allowed by the server) – It rarely used.


  Server Errors:-
a.     500:-  Internal Server Error ( You might be see like “500 Error”, ”HTTP Error 500”, “Internal Server Error”, “HTTP 500 – Internal Server Error”,……).(It  means something has gone wrong on the website’s server, but the server could not be more specific on what the exact problem is)


                                       (Or)
Invalid parameter values passed in payload



                               (Or)

Invalid value passed in path parameter



a.     501:- Not Implemented (The server either does not recognize the request method, or it lacks the ability to fulfill the request. The error occurs when the Web server does not understand or does not support the HTTP method it finds in the HTTP data stream sent to it by the client.)

Invalid method selected:-


a.     503:- Service Unavailable (Does not imply that a server has to use it when becoming overloaded. Some servers might simply refuse the connection.)
b.     505:- HTTP Version Not Supported (Does not imply that a server has to use it when becoming overloaded. Some servers might simply refuse the connection.) - It rarely used

UI Exceptions/ Error Messages:-
a.     Null pointer exceptions
b.     HTTP Error 500
c.     *. – All fields are mandatory
d.     User Name is should not be xxxxx – Characters – as per length defined in db
e.     Description/ Address is more than xxxxx – characters – as per length defined in db
f.      Amount should be numeric values
g.     Insufficient data to display charts
h.     Account number already exist – when user is trying to create an account which is already exist in db
i.      File size exceeded/ should not be more than xxxx/kb(or) mb – when use uploading any file/doc/…
j.      Authentication Failed (Login with an invalid credentials)





Mobile Exceptions / Error Handling:-
 It depends on app/Mobile OS/ Mobile device and other things.
a.     Unable to install app (For example :- Due to the unsupported device/ OS)
b.     Application has stopped unexpectedly. Please try again  - (window announces that the application has crashed, mainly because a runtime exceptions or error)
c.     Network failure for hosts ( For example:- Secure connection failed/ Time out/ Cannot find host/Not connected to internet/Cannnot connect to host)
d.     Applying updates – During updates are installing
e.     Authentication Failed (Login failed with an invalid credentials)
f.      Account has been blocked ( When log fails with multiple times)
g.     Insufficient memory (When hard disc doesn’t have the sufficient memory to install the app)
h.      Product is not available (When trying to find a financial product which doesn’t exist)
i.      Network error (When network fails)
j.      Error Establishing a Database Connection – Unable to establish the database connection
k.     Installation is successful – after app installed successfully
l.      Uninstalled app successfully -  after uninstalling the app
m.   Select the valid account – when user want’s to select any specific type of account
n.      Reasons for mobile app crash:- Memory Management, Network Management
o.     Caught exceptions - occasional timeout of a network connection during a request for data, are errors in your app which you've implemented code to handle
p.     Uncaught Exception Measurement - Uncaught exceptions represent instances where your app encountered unexpected conditions at runtime and are often fatal, causing the app to crash.
q.     Session time out – When login page is opened more than specified amount of time (idle time).
r.      Account has been cancelled/ doesn’t exit error message  – when user canceled/not exist his account
s.      Memory leaks - a memory leak in Java happens when you hold on to an Object long after its purpose has been served. (Doing a series of tests and returning back to the same place. Now, you compare the memory footprint before starting the test and right after. If the memory consumed after is higher than when you started off, you’ve probably leaked some memory during the test. Example:- Everytime user viewed a page and returned back to the home screen, the App’s memory would increase. What is happening is that each time a new activity was loaded, the App downloaded some data, and forgot to clear it when the used returned to the home screen, resulting in the leak.)



Java exceptions:-

a.     Array Index out of bound exception (If you are inserting any value in the wrong index, it would result ArrayIndexOutOfBoundsException)
b.     Class not found exception (Could not find the class which user defined in the code)
c.     Null pointer exception (If we have null value in any variable, performing any operation by the variable occurs an NullPointerException)
d.     NumberFormatException (The wrong formatting of any value, may occur NumberFormatException. Suppose I have a string variable that have characters, converting this variable into digit will occur NumberFormatException)
e.     IO Exception (whenever an input or output operation is failed or interpreted. Note that this won't be thrown for Reading or writing to Memory as Java will be handling it automatically)
f.      SQL Exception (Retrieve the String object that contains this description by calling the method SQLException.getMessage)
g.     Method Not Found
h.     NoSuchMethodException (A requested method does not exist.)
i.      UnsupportedOperationException (An unsupported operation was encountered)
j.      SecurityException (Attempt to violate security.)
k.     IllegalThreadStateException (Requested operation not compatible with current thread state.)
l.      IllegalStateException (Environment or application is in incorrect state.)
m.   IllegalArgumentException (Illegal argument used to invoke a method)
n.     ClassCastException (Invalid cast)
o.     ArrayStoreException (Assignment to an array element of an incompatible type)
p.     NoClassDefFoundError – (Thrown when the JVM can’t find a class it needs, because of a command-line error, a classpath issue, or a missing .class file.)
q.     StackOverflowError – (Typically thrown when a method recurses too deeply. (Each invocation is added to the stack.)
r.      ExceptionInInitializerError – (Thrown when attempting to initialize a static variable or an initialization block.)
s.      FileNotFoundException (attempt to open a non-existent file for reading)



Runtime with an invalid port


Requests should fail with ‘Connection refused error message’








No comments:

Post a Comment