Layer CA API Gateway - Obtaining the Status Code in method onError of MAS.invoke
search cancel

Layer CA API Gateway - Obtaining the Status Code in method onError of MAS.invoke

book

Article ID: 267132

calendar_today

Updated On:

Products

CA Mobile API Gateway

Issue/Introduction

Obtaining the request code of the method onError of MAS.Invoke for

if(Objects.equals(e.getMessage(), "Unauthorized")) {
Log.e("HTTP Status Code", "401");
}

 

 

Environment

Release : 4.2

Resolution

To expose the http status code you can use the sample below.

int responseCode = ((TargetApiException)e.getCause()).getResponse().getResponseCode();