From 4402ed8cabab2aa3c9adc0166e87f295405b3b3d Mon Sep 17 00:00:00 2001 From: Marc Bernard <59966492+mbtools@users.noreply.github.com> Date: Wed, 16 Dec 2020 09:09:29 -0500 Subject: [PATCH] Add refresh after failed uninstall (#4334) * Add refresh after failed uninstall If uninstall does not complete successfully, the old state of the repo will be shown. This will refresh the state and properly show which objects were deleted and which still remain. * Update src/zcl_abapgit_repo_srv.clas.abap Co-authored-by: Lars Hvam Co-authored-by: Lars Hvam --- src/zcl_abapgit_repo_srv.clas.abap | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/zcl_abapgit_repo_srv.clas.abap b/src/zcl_abapgit_repo_srv.clas.abap index f116bd692..0046e859f 100644 --- a/src/zcl_abapgit_repo_srv.clas.abap +++ b/src/zcl_abapgit_repo_srv.clas.abap @@ -527,6 +527,7 @@ CLASS zcl_abapgit_repo_srv IMPLEMENTATION. * todo, this should be a method on the repo instead? DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt. + DATA: lx_error TYPE REF TO zcx_abapgit_exception. CREATE OBJECT ri_log TYPE zcl_abapgit_log. ri_log->set_title( 'Uninstall Log' ). @@ -539,9 +540,15 @@ CLASS zcl_abapgit_repo_srv IMPLEMENTATION. lt_tadir = zcl_abapgit_factory=>get_tadir( )->read( io_repo->get_package( ) ). - zcl_abapgit_objects=>delete( it_tadir = lt_tadir - is_checks = is_checks - ii_log = ri_log ). + TRY. + zcl_abapgit_objects=>delete( it_tadir = lt_tadir + is_checks = is_checks + ii_log = ri_log ). + CATCH zcx_abapgit_exception INTO lx_error. + " If uninstall fails, repo needs a refresh to show which objects where deleted and which not + io_repo->refresh( ). + RAISE EXCEPTION lx_error. + ENDTRY. delete( io_repo ).