There is no error checking done for any of the API. Please add error checking and print error message and return the proper error codes.