import traceback


def handle_error(e, debug=False, url=None):
    def handle_unexpected_error():
        if not debug:
            traceback.print_exc()

        print('')
        print('=' * 20)
        print("Unexpected Error Happened.")
        bug_report_url = "https://github.com/M157q/gettitle/issues"
        t = "Please report the error message above to {}"
        print(t.format(bug_report_url))
        print('=' * 20)
        exit()

    def handle_connection_error(url):
        t = 'Check your network connection or the URL "{}" is invalid.'
        print(t.format(url))

    if debug:
        traceback.print_exc()
    else:
        handle_unexpected_error()

@@ -427,23 +427,8 @@
  20)
-%0A        exit()
 %0A%0A  
@@ -653,8 +653,20 @@
 error()%0A
+%0A    exit()%0A

Make handle_error() exit program