kintoneAPIException

Handle error responses from the Kintone Rest API

Methods

getHttpErrorCode

Declaration

func getHttpErrorCode() -> Int?

Parameter

(none)

Return

int

Sample code

Get http error code Source code

    let recordManagement = Record(connection)
    recordManagement.getRecord(-1, 1).then{response in
        print(response)  
    }.catch{ error in
        if error is KintoneAPIException {
            print((error as! KintoneAPIException).getHttpErrorCode()!)
        }
    }

getErrorResponse

Declaration

func getErrorResponse() -> ErrorResponse?

Parameter

(none)

Return

ErrorResponse

Sample code

Get apps with error response Source code

    let recordManagement = Record(connection)
    recordManagement.getRecord(-1, 1).then{response in
        print(response)  
    }.catch{ error in
        if error is KintoneAPIException {
            print((error as! KintoneAPIException).getErrorResponse().getId()!)
            print((error as! KintoneAPIException).getErrorResponse().getMessage()!)
            print((error as! KintoneAPIException).getErrorResponse().getCode()!)
        }
    }

getErrorResponses

Declaration

func getErrorResponses() -> Array<ErrorResponse>?

Parameter

(none)

Return

ArrayList<ErrorResponse>

Sample code

Get apps with error responses Source code

    // Init Bulk request
    var bulkRequest = BulkRequest(connection);

    var record: [String: FieldValue] = [:]

    let fv = FieldValue()
    fv.setType(FieldType.SINGLE_LINE_TEXT)
    fv.setValue("test_AddRecord")

    record["Your_Field_Code"] = fv
    bulkRequest = try bulkRequest?.addRecord(-1, record)
    bulkRequest?.execute().catch{error in
        if error is KintoneAPIException {
            print((error as! KintoneAPIException).getErrorResponses().toString()!)
        }
        else {
            print((error as! Error).localizedDescription))
        }
    }