Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: URL of the REST API
required: true
default: https://release.openimis.org/rest/
app_name:
cli_app_name:
description: Display name of the application
required: false
default: Claims Manual
Expand Down Expand Up @@ -37,18 +37,31 @@ jobs:
with:
java-version: 1.8

- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ github.event.inputs.application_id }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

- uses: actions/cache@v2
with:
path: |
~/.android
key: ${{ runner.os }}-${{ github.event.inputs.application_id }}

- name: Environment info
run: |
gradle --version
echo url ${{ github.event.inputs.api_base_url }}
echo app name ${{ github.event.inputs.app_name }}
echo app name ${{ github.event.inputs.cli_app_name }}

- name: build
run: |
./gradlew assembleCliDebug --stacktrace
env:
API_BASE_URL: "${{ github.event.inputs.api_base_url }}"
CLI_APP_NAME: "${{ github.event.inputs.app_name }}"
CLI_APP_NAME: "${{ github.event.inputs.cli_app_name }}"
CLI_APP_DIR: "${{ github.event.inputs.app_dir }}"
CLI_JAVA_DIR: "${{ github.event.inputs.cli_java_dir }}"
CLI_RES_DIR: "${{ github.event.inputs.cli_res_dir }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ public HttpResponse postToRestApi(Object object, String functionName, boolean ad
HttpResponse response = httpClient.execute(httpPost);
int responseCode = response.getStatusLine().getStatusCode();
Log.i("HTTP_POST", uri + functionName + " - " + responseCode);
if (responseCode >= 400) {
Log.e("HTTP_POST", object.toString());
HttpEntity entity = response.getEntity();
if (entity != null) {
String errorPayload = EntityUtils.toString(entity);
Log.e("HTTP_POST", "error payload" + errorPayload);
}
}
Comment on lines +67 to +74
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code will break any error handling requiring the response content, as it is consumed upon read. I added similar code to the getContent method so it can be logged and used for error handling.

return response;
} catch (IOException e) {
e.printStackTrace();
Expand Down