Browse Source

use slightly more specific exception types; upgrade pylint from 2.15.10 to 2.16.1

https://github.com/fphammerle/tooncher/pull/99
Fabian Peter Hammerle 1 year ago
parent
commit
c14c8f39b9
3 changed files with 15 additions and 9 deletions
  1. 6 0
      CHANGELOG.md
  2. 6 6
      Pipfile.lock
  3. 3 3
      tooncher/__init__.py

+ 6 - 0
CHANGELOG.md

@@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 ## Unreleased
+### Changed
+- raise `ValueError` instead of `Exception` when incompatible combination of
+  arguments was given
+- raise `RuntimeError` instead of `Exception` when server send
+  unexpected / unsupported response
+
 ### Removed
 - compatibility with `python3.5` & `python3.6`
 

+ 6 - 6
Pipfile.lock

@@ -63,11 +63,11 @@
     "develop": {
         "astroid": {
             "hashes": [
-                "sha256:6891f444625b6edb2ac798829b689e95297e100ddf89dbed5a8c610e34901501",
-                "sha256:df164d5ac811b9f44105a72b8f9d5edfb7b5b2d7e979b04ea377a77b3229114a"
+                "sha256:23c718921acab5f08cbbbe9293967f1f8fec40c336d19cd75dc12a9ea31d2eb2",
+                "sha256:bd1aa4f9915c98e8aaebcd4e71930154d4e8c9aaf05d35ac0a63d1956091ae3f"
             ],
             "markers": "python_full_version >= '3.7.2'",
-            "version": "==2.13.5"
+            "version": "==2.14.1"
         },
         "attrs": {
             "hashes": [
@@ -343,11 +343,11 @@
         },
         "pylint": {
             "hashes": [
-                "sha256:9df0d07e8948a1c3ffa3b6e2d7e6e63d9fb457c5da5b961ed63106594780cc7e",
-                "sha256:b3dc5ef7d33858f297ac0d06cc73862f01e4f2e74025ec3eff347ce0bc60baf5"
+                "sha256:bad9d7c36037f6043a1e848a43004dfd5ea5ceb05815d713ba56ca4503a9fe37",
+                "sha256:ffe7fa536bb38ba35006a7c8a6d2efbfdd3d95bbf21199cad31f76b1c50aaf30"
             ],
             "index": "pypi",
-            "version": "==2.15.10"
+            "version": "==2.16.1"
         },
         "pylint-import-requirements": {
             "hashes": [

+ 3 - 3
tooncher/__init__.py

@@ -97,7 +97,7 @@ def _login(
             "queueToken": queue_token,
         }
     else:
-        raise Exception("either specify username or queue token")
+        raise ValueError("either specify username or queue token")
     resp_data = _api_request(
         url=_LOGIN_API_URL,
         params=req_params,
@@ -110,7 +110,7 @@ def _login(
         )
     if resp_data["success"] == "delayed":
         return _LoginDelayed(queue_token=resp_data["queueToken"])
-    raise Exception(repr(resp_data))
+    raise RuntimeError(repr(resp_data))
 
 
 def launch(
@@ -131,7 +131,7 @@ def launch(
             validate_ssl_cert=validate_ssl_certs,
         )
     if not isinstance(result, _LoginSuccessful):
-        raise Exception(f"unexpected response: {result!r}")
+        raise RuntimeError(f"unexpected response: {result!r}")
     process = start_engine(
         engine_path=engine_path,
         gameserver=result.gameserver,