Repository: terminusdb/terminusdb-client-python
Issue: Bad treatment / Error when database is not set

**Describe the bug**
If I try to connect to a database when I have not yet specified which database.

```
terminusdb_client.woqlclient.errors.DatabaseError: The following descriptor could not be resolved to a resource: 'admin/None/local/branch/main'
```

**To Reproduce**

```python
server_url = "https://127.0.0.1:6363"
user = "admin"
account = "admin"
key = "root"
dbid = "bank_balance_example"
repository = "local"
label = "Bank Balance Example"
description = "An example database for playing with bank accounts"

client = WOQLClient(server_url)
client.connect(user=user,account=account,key=key)
# No database...
WQ().cast("doc:foo", "owl:Thing", "v:X").execute(client)
```

**Info (please complete the following information):**
 - Python Client v1.0


Changed files:
terminusdb_client/tests/test_woqlClient.py, terminusdb_client/woqlclient/errors.py, terminusdb_client/woqlclient/woqlClient.py

diff --git a/terminusdb_client/tests/test_woqlClient.py b/terminusdb_client/tests/test_woqlClient.py
index cf4a13c..822a7d3 100644
--- a/terminusdb_client/tests/test_woqlClient.py
+++ b/terminusdb_client/tests/test_woqlClient.py
@@ -7,6 +7,7 @@ import pytest
 import requests
 
 from terminusdb_client.__version__ import __version__
+from terminusdb_client.woqlclient.errors import InterfaceError
 from terminusdb_client.woqlclient.woqlClient import WOQLClient
 
 from .mockResponse import MOCK_CAPABILITIES
@@ -209,6 +210,14 @@ def test_query(mocked_requests, mocked_requests2):
     )
 
 
+@mock.patch("requests.get", side_effect=mocked_requests_get)
+def test_query_nodb(mocked_requests):
+    woql_client = WOQLClient("http://localhost:6363")
+    woql_client.connect(user="admin", account="admin", key="root")
+    with pytest.raises(InterfaceError):
+        woql_client.query(WoqlStar)
+
+
 @mock.patch("requests.get", side_effect=mocked_requests_get)
 @mock.patch.object(WOQLClient, "_dispatch_json")
 def test_query_commit_count(mocked_execute, mocked_requests):
diff --git a/terminusdb_client/woqlclient/errors.py b/terminusdb_client/woqlclient/errors.py
index bcd32b7..dc40a98 100644
--- a/terminusdb_client/woqlclient/errors.py
+++ b/terminusdb_client/woqlclient/errors.py
@@ -6,7 +6,7 @@ class Error(Exception):
 
 
 class InterfaceError(Error):
-    """Exception for errors related to the interface.
+    """Exception raised for errors that are related to the database interface rather than the database itself.
 
     Attributes
     ----------
@@ -42,13 +42,15 @@ class DatabaseError(Error):
         """
         super().__init__()
         if (
-            response.headers["content-type"][:len("application/json")]
+            response.headers["content-type"][: len("application/json")]
             == "application/json"
         ):
             self.error_obj = response.json()
             if self.error_obj.get("api:message"):
                 self.message = self.error_obj["api:message"]
-            elif "api:error" in self.error_obj and self.error_obj["api:error"].get("vio:message"):
+            elif "api:error" in self.error_obj and self.error_obj["api:error"].get(
+                "vio:message"
+            ):
                 self.message = self.error_obj["api:error"]["vio:message"]
             else:
                 self.message = (
diff --git a/terminusdb_client/woqlclient/woqlClient.py b/terminusdb_client/woqlclient/woqlClient.py
index 02faf33..bf449b2 100644
--- a/terminusdb_client/woqlclient/woqlClient.py
+++ b/terminusdb_client/woqlclient/woqlClient.py
@@ -111,10 +111,15 @@ class WOQLClient:
         The connection will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the connection, unless connect is call again."""
         self._connected = False
 
-    def _check_connection(self) -> None:
-        """Raise connection InterfaceError if not connected"""
+    def _check_connection(self, check_db=True) -> None:
+        """Raise connection InterfaceError if not connected
+        Defaults to check if a db is connected"""
         if not self._connected:
-            raise InterfaceError("Client is not connected to a TerminusDB database.")
+            raise InterfaceError("Client is not connected to a TerminusDB server.")
+        if check_db and self._db is None:
+            raise InterfaceError(
+                "No database is connected. Please either connect to a database or create a new database."
+            )
 
     def _get_current_commit(self):
         woql_query = (
@@ -565,6 +570,11 @@ class WOQLClient:
         include_schema : bool
             If ``True``, a main schema graph will be created, otherwise only a main instance graph will be created.
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a server
+
         Examples
         --------
         >>> client = WOQLClient("https://127.0.0.1:6363/")
@@ -586,6 +596,8 @@ class WOQLClient:
         if accountid is None:
             accountid = self._account
 
+        self._check_connection(check_db=False)
+
         self._db = dbid
         self._account = accountid
         self._connected = True
@@ -615,6 +627,8 @@ class WOQLClient:
         ------
         UserWarning
             If the value of dbid is None.
+        InterfaceError
+            if the client does not connect to a server.
 
         Examples
         -------
@@ -622,6 +636,8 @@ class WOQLClient:
         >>> client.delete_database("<database>", "<account>")
         """
 
+        self._check_connection(check_db=False)
+
         if dbid is None:
             raise UserWarning(
                 f"You are currently using the database: {self._account}/{self._db}. If you want to delete it, please do 'delete_database({self._db},{self._account})' instead."
@@ -656,6 +672,8 @@ class WOQLClient:
         ------
         ValueError
             If the value of graph_type is invalid.
+        InterfaceError
+            if the client does not connect to a database
         """
         self._check_connection()
         if graph_type in ["inference", "schema", "instance"]:
@@ -688,6 +706,8 @@ class WOQLClient:
         ------
         ValueError
             If the value of graph_type is invalid.
+        InterfaceError
+            if the client does not connect to a database
         """
         self._check_connection()
         if graph_type in ["inference", "schema", "instance"]:
@@ -712,6 +732,11 @@ class WOQLClient:
         graph_id : str
             Graph identifier.
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
         Returns
         -------
         str
@@ -737,6 +762,11 @@ class WOQLClient:
             Valid set of triples in Turtle format.
         commit_msg : str
             Commit message.
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
         """
         self._check_connection()
         commit = self._generate_commit(commit_msg)
@@ -762,6 +792,11 @@ class WOQLClient:
             Valid set of triples in Turtle format.
         commit_msg : str
             Commit message.
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
         """
         self._check_connection()
         commit = self._generate_commit(commit_msg)
@@ -794,6 +829,11 @@ class WOQLClient:
             Graph type, either "inference", "instance" or "schema". Default to be "instance"
         graph_id : str, optional
             Graph identifier. Default to be "main"
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
         """
         self._check_connection()
         options = {}
@@ -832,6 +872,11 @@ class WOQLClient:
             Graph type, either "inference", "instance" or "schema". Default to be "instance"
         graph_id : str, optional
             Graph identifier. Default to be "main"
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
         """
         self._check_connection()
         if commit_msg is None:
@@ -868,6 +913,11 @@ class WOQLClient:
             Graph type, either "inference", "instance" or "schema". Default to be "instance"
         graph_id : str, optional
             Graph identifier. Default to be "main"
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
         """
         self._check_connection()
         if commit_msg is None:
@@ -927,6 +977,11 @@ class WOQLClient:
         file_dict:
             File dictionary to be associated with post name => filename, for multipart POST
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
         Examples
         -------
         >>> WOQLClient(server="http://localhost:6363").query(woql, "updating graph")
@@ -983,6 +1038,11 @@ class WOQLClient:
             New branch identifier.
         empty : bool
             Create an empty branch if true (no starting commit)
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
         """
         self._check_connection()
         if empty:
@@ -1018,6 +1078,11 @@ class WOQLClient:
         author: str, optional
             option to overide the author of the operation
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
         Returns
         -------
         dict
@@ -1050,6 +1115,17 @@ class WOQLClient:
         )
 
     def fetch(self, remote_id: str) -> dict:
+        """Fatch the brach from a remote
+
+        Parameters
+        ----------
+        remote_id: str
+            id of the remote
+
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database"""
         self._check_connection()
         return self._dispatch_json("post", self._fetch_url(remote_id))
 
@@ -1073,6 +1149,11 @@ class WOQLClient:
         author: str, optional
             option to overide the author of the operation
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
         Examples
         -------
         >>> WOQLClient(server="http://localhost:6363").push(remote="origin", remote_branch = "main", author = "admin", message = "commit message"})
@@ -1119,6 +1200,11 @@ class WOQLClient:
         author : str, optional
             the commit author
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
         Returns
         -------
         dict
@@ -1140,6 +1226,11 @@ class WOQLClient:
     def reset(self, commit_path: str) -> None:
         """Reset the current branch HEAD to the specified commit path.
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
         Notes
         -----
         The "remote" repo can live in the local database.
@@ -1166,6 +1257,11 @@ class WOQLClient:
     def optimize(self, path: str) -> None:
         """Optimize the specified path.
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
         Notes
         -----
         The "remote" repo can live in the local database.
@@ -1188,6 +1284,11 @@ class WOQLClient:
     ) -> dict:
         """Squash the current branch HEAD into a commit
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
         Notes
         -----
         The "remote" repo can live in the local database.
@@ -1232,6 +1333,11 @@ class WOQLClient:
         Description : str, optional
             Optional description about the cloned database.
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a database
+
         Examples
         --------
         >>> client = WOQLClient("https://127.0.0.1:6363/")
@@ -1448,11 +1554,16 @@ class WOQLClient:
         account : str
             The account / organization id that the user is acting through
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a server
+
         Returns
         -------
         dict or None if not found
         """
-        self._check_connection()
+        self._check_connection(check_db=False)
         db_ids = []
         all_dbs = []
         for this_db in self.get_databases():
@@ -1484,11 +1595,16 @@ class WOQLClient:
         """
         Returns a list of database metadata records for all databases the user has access to
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a server
+
         Returns
         -------
         list of dicts
         """
-        self._check_connection()
+        self._check_connection(check_db=False)
         all_dbs = []
         for scope in self._dispatch_json("get", self._api)["system:role"][
             "system:capability"
@@ -1501,11 +1617,16 @@ class WOQLClient:
         """
         Returns a list of database ids for all databases the user has access to
 
+        Raises
+        ------
+        InterfaceError
+            if the client does not connect to a server
+
         Returns
         -------
         list of dicts
         """
-        self._check_connection()
+        self._check_connection(check_db=False)
         all_data = self.get_databases()
         all_dbs = []
         for data in all_data: