Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

Changeset 197

Show
Ignore:
Timestamp:
10/19/07 10:47:08
Author:
fumanchu
Message:

Error message audit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/geniusql/conns.py

    r170 r197  
    3636    def __call__(self): 
    3737        """Return a connection.""" 
     38        exc = None 
    3839        for i in xrange(self.retry): 
    3940            try: 
     
    4243                self.refs[weakref.ref(w, self._release)] = w.conn 
    4344                return w 
    44             except errors.OutOfConnectionsError
     45            except errors.OutOfConnectionsError, exc
    4546                time.sleep(i + 1) 
    4647                conn = None 
    47         raise errors.OutOfConnectionsError() 
     48        if exc: 
     49            args = exc.args 
     50        else: 
     51            args = ["No connection found in %r iterations." % self.retry] 
     52        raise errors.OutOfConnectionsError(*args) 
    4853     
    4954    def _release(self, ref): 
     
    7580    def __call__(self): 
    7681        """Return a connection from the pool.""" 
     82        exc = None 
    7783        for i in self.iterations: 
    7884            try: 
     
    9399                self.refs[weakref.ref(w, self._release)] = w.conn 
    94100                return w 
    95             except errors.OutOfConnectionsError
     101            except errors.OutOfConnectionsError, exc
    96102                time.sleep(i) 
    97103                conn = None 
    98         raise errors.OutOfConnectionsError() 
     104         
     105        if exc: 
     106            args = exc.args 
     107        else: 
     108            args = ["No connection found in %r iterations." % self.iterations] 
     109        raise errors.OutOfConnectionsError(*args) 
    99110     
    100111    def _release(self, ref): 
     
    155166            return self.conns[threadid] 
    156167        except KeyError: 
     168            exc = None 
    157169            for i in xrange(self.retry): 
    158170                try: 
     
    160172                    self.conns[threadid] = conn 
    161173                    return conn 
    162                 except errors.OutOfConnectionsError
     174                except errors.OutOfConnectionsError, exc
    163175                    conn = None 
    164176                    time.sleep(i + 1) 
    165             raise errors.OutOfConnectionsError() 
     177            if exc: 
     178                args = exc.args 
     179            else: 
     180                args = ["No connection found in %r iterations." % self.retry] 
     181            raise errors.OutOfConnectionsError(*args) 
    166182     
    167183    def shutdown(self): 
  • trunk/geniusql/objects.py

    r195 r197  
    518518            if t.name == tablename: 
    519519                return t 
    520         raise errors.MappingError(tablename) 
     520        raise errors.MappingError("Table % not found." % tablename) 
    521521     
    522522    def _get_columns(self, table, conn=None): 
  • trunk/geniusql/providers/ado.py

    r154 r197  
    394394                return self.tableclass(name, self.db.quote(name), 
    395395                                       self, created=True) 
    396         raise errors.MappingError(tablename) 
     396        raise errors.MappingError("Table %r not found." % tablename) 
    397397     
    398398    def _get_indices(self, table=None, conn=None): 
  • trunk/geniusql/providers/mysql.py

    r188 r197  
    526526                return self.tableclass(name, self.db.quote(name), 
    527527                                       self, created=True) 
    528         raise errors.MappingError(tablename) 
     528        raise errors.MappingError("Table %r not found." % tablename) 
    529529     
    530530    def _get_columns(self, table, conn=None): 
  • trunk/geniusql/providers/postgres.py

    r180 r197  
    697697    def _get_table(self, tablename, conn=None): 
    698698        if (not self.discover_pg_tables) and tablename.startswith("pg_"): 
    699             raise errors.MappingError(tablename) 
     699            raise errors.MappingError( 
     700                "Table %r not found. Set schema.discover_pg_tables to True " 
     701                "if you want to discover Postgres system tables (pg_*)." % 
     702                tablename) 
    700703         
    701704        data, _ = self.db.fetch("SELECT oid FROM pg_class WHERE " 
     
    725728                 
    726729                return t 
    727         raise errors.MappingError(tablename) 
     730        raise errors.MappingError("Table %r not found." % tablename) 
    728731     
    729732    def _get_columns(self, table, conn=None): 
  • trunk/geniusql/providers/psycopg.py

    r135 r197  
    4141        except _psycopg.DatabaseError, x: 
    4242            if x.args[0].startswith('could not connect'): 
    43                 raise errors.OutOfConnectionsError(
     43                raise errors.OutOfConnectionsError(*x.args
    4444            raise 
    4545     
  • trunk/geniusql/providers/sqlite.py

    r167 r197  
    682682                return self.tableclass(name, self.db.quote(name), 
    683683                                       self, created=True) 
    684         raise errors.MappingError(tablename) 
     684        raise errors.MappingError("Table %r not found." % tablename) 
    685685     
    686686    def _get_columns(self, table, conn=None):