Unexpected error code for unrecognized arguments
If providing unrecognized arguments to CodeChecker (tried with check and analyze) the exit code is 2 ("At least one report emitted by an analyzer") instead of the expected 1 ("CodeChecker error"). Maybe this does also affect other CodeChecker commands and maybe also other types of errors?


CodeChecker analyzer version:
```
---------------------------------------------------------------
Kind                 | Version                                 
---------------------------------------------------------------
Base package version | 6.17.0                                  
Package build date   | 2021-08-23T13:08                        
Git commit ID (hash) | e3b63963ae0c0cc32983c20017cdac7e0f05956a
Git tag information  | 6.17                                    
---------------------------------------------------------------
```


Repro:
```
$ CodeChecker check -b "ninja" bogus
usage: CodeChecker [-h] {check} ...
CodeChecker: error: unrecognized arguments: bogus
$ echo $?
2
```

This was run on fairly up-to-date Arch Linux. 


diff --git a/analyzer/tests/functional/cmdline/test_cmdline.py b/analyzer/tests/functional/cmdline/test_cmdline.py
index efa03bf8..eb8e6cbe 100644
--- a/analyzer/tests/functional/cmdline/test_cmdline.py
+++ b/analyzer/tests/functional/cmdline/test_cmdline.py
@@ -84,6 +84,12 @@ class TestCmdline(unittest.TestCase):
         parse_help = [env.codechecker_cmd(), 'parse', '--help']
         self.assertEqual(0, run_cmd(parse_help)[0])
 
+    def test_invalid_subcommand(self):
+        """ Call CodeChecker with and invalid subcommand. """
+
+        dummy_cmd = [env.codechecker_cmd(), "dummy"]
+        self.assertEqual(1, run_cmd(dummy_cmd)[0])
+
     def test_checkers(self):
         """ Listing available checkers. """
 
diff --git a/codechecker_common/cli.py b/codechecker_common/cli.py
index 0895f25e..94e74a42 100755
--- a/codechecker_common/cli.py
+++ b/codechecker_common/cli.py
@@ -19,6 +19,18 @@ import signal
 import sys
 
 
+class ArgumentParser(argparse.ArgumentParser):
+    def error(self, message):
+        """
+        By default argparse will exit with error code 2 in case of error, but
+        we are using this error code for different purposes. For this reason
+        we will override this function, so we will exit with error code 1 in
+        such cases too.
+        """
+        self.print_usage(sys.stderr)
+        self.exit(1, f"{self.prog}: error: {message}\\n")
+
+
 def add_subcommand(subparsers, sub_cmd, cmd_module_path, lib_dir_path):
     """
     Load the subcommand module and then add the subcommand to the available
@@ -106,7 +118,7 @@ def main():
     signal.signal(signal.SIGTERM, signal_handler)
 
     try:
-        parser = argparse.ArgumentParser(
+        parser = ArgumentParser(
             prog="CodeChecker",
             formatter_class=argparse.RawDescriptionHelpFormatter,
             description="""Run the CodeChecker sourcecode analyzer framework.
['analyzer/tests/functional/cmdline/test_cmdline.py', 'codechecker_common/cli.py']