Added Error handling, changed api class

Put the error handling in a different file. Using raise to bring up
errors. Also changed up some of the method returns of the Api class.
Should be able to catch all the exceptions that are defined now.