Create a new session for the given user Args: username: Username for the session Returns: Session instance Raises: SessionError: If session creation fails
(self, username: str)
| 55 | raise ConnectionError(f"Failed to open database: {e}") |
| 56 | |
| 57 | def session(self, username: str): |
| 58 | """ |
| 59 | Create a new session for the given user |
| 60 | |
| 61 | Args: |
| 62 | username: Username for the session |
| 63 | |
| 64 | Returns: |
| 65 | Session instance |
| 66 | |
| 67 | Raises: |
| 68 | SessionError: If session creation fails |
| 69 | """ |
| 70 | try: |
| 71 | session_id = self._db.create_session(username) |
| 72 | return Session(session_id, self._db, username) |
| 73 | except Exception as e: |
| 74 | raise SessionError(f"Failed to create session: {e}") |
| 75 | |
| 76 | def close(self): |
| 77 | """Close the database connection""" |
no test coverage detected