Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit b634303

Browse files
committed
feat(Battleship): added exceptions module for errors
1 parent 814a2e3 commit b634303

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

projects/Battleship/exceptions.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class BattleshipException(Exception):
2+
"""Base Class for Battleship Exceptions"""
3+
4+
5+
class InvalidShipCoordinateException(BattleshipException):
6+
"""Raises error when a ship's coordinates are invalid."""
7+
8+
9+
class InvalidHitMoveException(BattleshipException):
10+
"""Raises error when a player tries to give an invalid hit move coordinate."""
11+
12+
13+
class BoardException(BattleshipException):
14+
"""Base class for exceptions related to the game board."""
15+
16+
17+
class GameException(BattleshipException):
18+
"""Base class for general exceptions related to the Battleship game."""

0 commit comments

Comments
 (0)