Use extended SQLite error codes
This commit is contained in:
		
							parent
							
								
									bd56b5fe3f
								
							
						
					
					
						commit
						3cab639e21
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -10,6 +10,7 @@ namespace nix {
 | 
			
		|||
[[noreturn]] void throwSQLiteError(sqlite3 * db, const FormatOrString & fs)
 | 
			
		||||
{
 | 
			
		||||
    int err = sqlite3_errcode(db);
 | 
			
		||||
    int exterr = sqlite3_extended_errcode(db);
 | 
			
		||||
 | 
			
		||||
    auto path = sqlite3_db_filename(db, nullptr);
 | 
			
		||||
    if (!path) path = "(in-memory)";
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +22,7 @@ namespace nix {
 | 
			
		|||
            : fmt("SQLite database '%s' is busy", path));
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
        throw SQLiteError("%s: %s (in '%s')", fs.s, sqlite3_errstr(err), path);
 | 
			
		||||
        throw SQLiteError("%s: %s (in '%s')", fs.s, sqlite3_errstr(exterr), path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SQLite::SQLite(const Path & path)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue