Changeset 155

Show
Ignore:
Timestamp:
11/18/07 17:08:21 (1 year ago)
Author:
chris
Message:

Add helpful messages when DatabaseException? is thrown.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lex/trunk/src/com/qwirx/lex/emdros/EmdrosDatabase.java

    r142 r155  
    8484        catch (TableException e) 
    8585        { 
    86             throw new DatabaseException(e, query); 
     86            throw new DatabaseException("Failed to execute query", e, query); 
    8787        } 
    8888        catch (BadMonadsException e) 
    8989        { 
    90             throw new DatabaseException(e, query); 
     90            throw new DatabaseException("Failed to execute query", e, query); 
    9191        } 
    9292        catch (EMdFDBDBError e) 
    9393        { 
    94             throw new DatabaseException(e, query); 
     94            throw new DatabaseException("Failed to execute query", e, query); 
    9595        } 
    9696        catch (EmdrosException e) 
    9797        { 
    98             throw new DatabaseException(e, query); 
     98            throw new DatabaseException("Failed to execute query", e, query); 
    9999        } 
    100100         
     
    151151        catch (TableException e) 
    152152        { 
    153             throw new DatabaseException(e, "SELECT MIN_M"); 
     153            throw new DatabaseException("Failed to get MIN_M", e,  
     154                "SELECT MIN_M"); 
    154155        } 
    155156        } 
     
    168169        catch (TableException e) 
    169170        { 
    170             throw new DatabaseException(e, "SELECT MAX_M"); 
     171            throw new DatabaseException("Failed to get MAX_M", e,  
     172                "SELECT MAX_M"); 
    171173        } 
    172174        } 
     
    198200        catch (TableException e) 
    199201        { 
    200             throw new DatabaseException(e,  
    201                 "SELECT ENUMERATION CONSTANTS FROM "+type); 
     202            throw new DatabaseException("Failed to get enumeration constants",  
     203                e, "SELECT ENUMERATION CONSTANTS FROM "+type); 
    202204        } 
    203205         
     
    232234        catch (TableException e) 
    233235        { 
    234             throw new DatabaseException(e, "MONAD SET CALCULATION "+query); 
     236            throw new DatabaseException("Failed to calculate monad set ", 
     237                e, "MONAD SET CALCULATION "+query); 
    235238        } 
    236239         
     
    297300        catch (TableException e) 
    298301        { 
    299             throw new DatabaseException(e, "SELECT FEATURES FROM ["+objectType+"]"); 
     302            throw new DatabaseException("Failed to get features",  
     303                e, "SELECT FEATURES FROM ["+objectType+"]"); 
    300304        } 
    301305 
     
    327331        catch (TableException e) 
    328332        { 
    329             throw new DatabaseException(e, "SELECT OBJECT TYPES"); 
     333            throw new DatabaseException("Failed to get the list of " + 
     334                        "object types", e, "SELECT OBJECT TYPES"); 
    330335        } 
    331336         
     
    458463        catch (TableException e) 
    459464        { 
    460             throw new DatabaseException(e, query); 
     465            throw new DatabaseException("Failed to get monads from object",  
     466                e, query); 
    461467        } 
    462468         
     
    483489        catch (SQLException e) 
    484490        { 
    485             throw new DatabaseException(e, query); 
     491            throw new DatabaseException("Failed to find database access " + 
     492                        "permissions", e, query); 
    486493        } 
    487494         
     
    504511        catch (SQLException e) 
    505512        { 
    506             throw new DatabaseException(e, "constructing monad set "
    507                 first+"-"+last); 
     513            throw new DatabaseException("Failed to construct monad set "
     514                first + "-" + last, e); 
    508515        } 
    509516        catch (BadMonadsException e) 
    510517        { 
    511             throw new DatabaseException(e, "constructing monad set "
    512                 first+"-"+last); 
     518            throw new DatabaseException("Failed to construct monad set "
     519                first + "-" + last, e); 
    513520        } 
    514521         
    515522        return monads.isEmpty(); 
    516523    } 
     524     
     525    public void delete() 
     526    { 
     527        env.delete(); 
     528    } 
    517529}