debugger: Refactor throw and return commands

They are very similar, so they can share almost all of their code. At the
same time, use early returns in the refactored function to avoid some
nesting.
25 jobs for debugger4 in 17 minutes and 43 seconds (queued for 21 minutes and 3 seconds)
Status Job ID Name Coverage
  Source Check
passed #69592
cppcheck

00:00:37

passed #69593
cpplint

00:01:00

passed #69594
eslint

00:00:38

passed #69591
fedora

00:02:25

 
  Test
passed #69597
no_graphics

00:02:00

passed #69598
no_profiler

00:02:10

passed #69599
no_readline

00:02:10

passed #69595
sanitizer_gcc

00:04:36

passed #69596
with_logging

00:02:04

 
  Manual
manual #69613
allowed to fail manual
armv8
manual #69600
allowed to fail manual
codequality
manual #69601
allowed to fail manual
code_statistics
manual #69615
allowed to fail manual
coverage
manual #69603
allowed to fail manual
fedora_gcc
manual #69609
allowed to fail manual
flatpak
manual #69604
allowed to fail manual
installed_tests
manual #69607
allowed to fail manual
lts
manual #69614
allowed to fail manual
ppc64le
manual #69602
allowed to fail manual
sanitizer_clang
manual #69606
allowed to fail manual
ubuntu_clang
manual #69605
allowed to fail manual
ubuntu_gcc
manual #69608
allowed to fail manual
valgrind
manual #69612
allowed to fail manual
zeal_11
manual #69610
allowed to fail manual
zeal_2
manual #69611
allowed to fail manual
zeal_4