Merge pull request #1027 from christianguenter2/Test_better_http_errors

Improved HTTP error display
This commit is contained in:
Lars Hvam 2017-10-26 16:58:16 +02:00 committed by GitHub
commit e25b4cc815

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(
@ -207,21 +209,21 @@ CLASS lcl_http_client IMPLEMENTATION.
http_invalid_state = 2 http_invalid_state = 2
http_processing_failed = 3 http_processing_failed = 3
OTHERS = 4 ). OTHERS = 4 ).
IF sy-subrc <> 0. IF sy-subrc <> 0.
CASE sy-subrc. " in case of HTTP_COMMUNICATION_FAILURE
WHEN 1. " make sure:
" make sure: " a) SSL is setup properly in STRUST
" a) SSL is setup properly in STRUST " b) no firewalls
" b) no firewalls " check trace file in transaction SMICM
" check trace file in transaction SMICM
lv_text = 'HTTP Communication Failure'. "#EC NOTEXT mi_client->get_last_error(
WHEN 2. IMPORTING
lv_text = 'HTTP Invalid State'. "#EC NOTEXT code = lv_code
WHEN 3. message = lv_message ).
lv_text = 'HTTP Processing failed'. "#EC NOTEXT
WHEN OTHERS. lv_text = |HTTP error { lv_code } occured: { lv_message }|.
lv_text = 'Another error occured'. "#EC NOTEXT
ENDCASE.
zcx_abapgit_exception=>raise( lv_text ). zcx_abapgit_exception=>raise( lv_text ).
ENDIF. ENDIF.
@ -502,7 +504,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