I am still learning promises in angular and have this bit of code where I am making a "GET" request two times. I want to run one get request before calling the other. This is working fine, but how would I handle errors here? If I get an error for my first GET request how do I find out what that error is and prevent my code from calling the second GET request? Examples with my code would be most helpful.

```
apiServices.login = function(user,password,callback) {
$http.get("http://magainteractive.com/prototypes/cisco-ima-dashboard/cms/web/api/login/login/?username="+user+"&password="+password+"")
        .then(function(contentResponse){
            resultsObject.content = contentResponse; 
            return $http.get("http://magainteractive.com/prototypes/cisco-ima-dashboard/cms/web/api/data/list/"); 
        })
        .then(function(dataResponse){
            resultsObject.reports = dataResponse;
            resultsObject.success = 1;
            console.log(resultsObject);

            callback(resultsObject);
            apiServices.useData(resultsObject);
        }); 
}

dummyData.login(username, password, function (dataStatus) {

            if (dataStatus.success = 1) {

                $rootScope.loggedIn = true;
                $rootScope.selectedDashboard = 1; 
            } else {
                console.log("Error");
            }
        });

```