display HTTP error codes and message

This commit is contained in:
Christian Günter 2017-10-25 18:12:18 +00:00
parent 369f86aef0
commit 826e5692c5

View File

@ -198,7 +198,9 @@ CLASS lcl_http_client IMPLEMENTATION.
METHOD send_receive. METHOD send_receive.
DATA lv_text TYPE string. DATA: lv_text TYPE string,
lv_code TYPE i,
lv_message TYPE string.
mi_client->send( ). mi_client->send( ).
mi_client->receive( mi_client->receive(
@ -208,20 +210,29 @@ CLASS lcl_http_client IMPLEMENTATION.
http_processing_failed = 3 http_processing_failed = 3
OTHERS = 4 ). OTHERS = 4 ).
IF sy-subrc <> 0. IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1. mi_client->get_last_error(
" make sure: IMPORTING
" a) SSL is setup properly in STRUST code = lv_code
" b) no firewalls message = lv_message ).
" check trace file in transaction SMICM
lv_text = 'HTTP Communication Failure'. "#EC NOTEXT lv_text = |HTTP error { lv_code } occured: { lv_code }|.
WHEN 2.
lv_text = 'HTTP Invalid State'. "#EC NOTEXT * CASE sy-subrc.
WHEN 3. * WHEN 1.
lv_text = 'HTTP Processing failed'. "#EC NOTEXT * " make sure:
WHEN OTHERS. * " a) SSL is setup properly in STRUST
lv_text = 'Another error occured'. "#EC NOTEXT * " b) no firewalls
ENDCASE. * " check trace file in transaction SMICM
* lv_text = 'HTTP Communication Failure'. "#EC NOTEXT
* WHEN 2.
* lv_text = 'HTTP Invalid State'. "#EC NOTEXT
* WHEN 3.
* lv_text = 'HTTP Processing failed'. "#EC NOTEXT
* WHEN OTHERS.
* lv_text = 'Another error occured'. "#EC NOTEXT
* ENDCASE.
zcx_abapgit_exception=>raise( lv_text ). zcx_abapgit_exception=>raise( lv_text ).
ENDIF. ENDIF.
@ -502,7 +513,7 @@ CLASS lcl_http IMPLEMENTATION.
DATA: lv_host TYPE string, DATA: lv_host TYPE string,
lt_list TYPE zif_abapgit_definitions=>ty_icm_sinfo2_tt, lt_list TYPE zif_abapgit_definitions=>ty_icm_sinfo2_tt,
li_exit TYPE ref to lif_exit. li_exit TYPE REF TO lif_exit.
CALL FUNCTION 'ICM_GET_INFO2' CALL FUNCTION 'ICM_GET_INFO2'
TABLES TABLES