nebius/SWE-bench-extra huggingface dataset:
Repository: gillejw/PDBT

Issue:
Add custom error handling
Create custom error handling class that extends the Python Exception class.

Comments:

Patch:
diff --git a/pdbt/exceptions.py b/pdbt/exceptions.py
new file mode 100644
index 0000000..2e449f1
--- /dev/null
+++ b/pdbt/exceptions.py
@@ -0,0 +1,8 @@
+class PDBTException(Exception):
+    '''
+    Base class for all errors raised from PDBT code.
+
+    Usage:
+
+    raise PDBTException("message")
+    '''
diff --git a/pyproject.toml b/pyproject.toml
index 6864d19..2172aab 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -37,6 +37,7 @@ dev = ["pytest", "pylint"]
 
 [tool.pytest.ini_options]
 minversion = "6.0"
+addopts = "-ra"
 testpaths = [
     "tests"
 ]
@@ -46,4 +47,5 @@ max-line-length = 88
 disable = [
     "C0114", # (missing-module-docstring)
     "C0115", # (missing-class-docstring)
+    "W0104", # (pointless-statement)
 ]
\ No newline at end of file


Test patch:
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_exception.py b/tests/test_exception.py
new file mode 100644
index 0000000..5a563f2
--- /dev/null
+++ b/tests/test_exception.py
@@ -0,0 +1,13 @@
+import pytest
+from pdbt.exceptions import PDBTException
+
+def test_zero_division():
+    '''Tests that python throws an exception when dividing by 0'''
+    with pytest.raises(ZeroDivisionError):
+        1 / 0
+
+class TestException():
+    def test_pdbtexception_throws_exception(self):
+        '''Tests that the PDBTException class is called when an error is raised'''
+        with pytest.raises(PDBTException) as err:
+            raise PDBTException(err)