pgtoolkit/pgdiff.py
changeset 61 703bba757605
parent 60 bb6b20106ff5
child 63 8c7f0a51ba50
--- a/pgtoolkit/pgdiff.py	Fri Jan 25 17:44:49 2013 +0100
+++ b/pgtoolkit/pgdiff.py	Fri Jan 25 18:04:17 2013 +0100
@@ -28,6 +28,10 @@
 from pgtoolkit.highlight import *
 
 
+class PgDiffError(Exception):
+    pass
+
+
 class DiffBase:
     COLORS = {
         '+' : BOLD | GREEN,
@@ -476,7 +480,13 @@
 
         Order: include, exclude
         include=[] means include everything
+
+        Raises:
+            PgDiffError: when schema from include list is not found in src db
+
         '''
+        for schema in include:
+            self._check_schema_exist(schema)
         self.include_schemas.clear()
         self.include_schemas.update(include)
         self.exclude_schemas.clear()
@@ -489,3 +499,8 @@
         self.exclude_tables.clear()
         self.exclude_tables.update(exclude)
 
+
+    def _check_schema_exist(self, schema):
+        if not schema in self.src.schemas:
+            raise PgDiffError('Schema "%s" not found in source database.' % schema)
+