 import AlamofireObjectMapper
 import PromiseKit
 
-//TODO: handle headers.
-
 public enum UnauthorizedCode: String {
     case invalidCredentials = "invalid-credentials",
     expiredAccessToken = "expired-access-token",

    invalidAuthorizationHeader = "invalid-authorization-header"
}

public enum SDException: ErrorType {
    case Unauthorized(code: UnauthorizedCode)
    case Forbidden

                let object = Mapper<T>().map(response.result.value)!
                success(object)
            case 400 :
                if let res = Mapper<SDResponse>().map(response.result.value),
                    let code = res.error?.code,
                    let badRequestCode = BadRequestCode(rawValue: code) {
                    error(SDException.BadRequest(code: badRequestCode))
                }
                else {
                    error(SDException.BadRequest(code: BadRequestCode.unhandledErrorCode))
                }
            case 401 :
                if let res = Mapper<SDResponse>().map(response.result.value),
                    let code = res.error?.code,
