mirror of https://github.com/stella-emu/stella.git
Don't throw exceptions with 'new'.
This commit is contained in:
parent
e4ede14ae5
commit
35f7b1dc51
|
@ -46,7 +46,7 @@ bool AbstractKeyValueRepositorySqlite::has(const string& key)
|
|||
try {
|
||||
SqliteStatement& stmt{stmtCount(key)};
|
||||
|
||||
if (!stmt.step()) throw new SqliteError("count failed");
|
||||
if (!stmt.step()) throw SqliteError("count failed");
|
||||
|
||||
const bool result = stmt.columnInt(0) != 0;
|
||||
stmt.reset();
|
||||
|
|
|
@ -28,8 +28,10 @@ CompositeKeyValueRepositorySqlite::CompositeKeyValueRepositorySqlite(
|
|||
const string& colKey2,
|
||||
const string& colValue
|
||||
)
|
||||
: myDb{db}, myTableName{tableName}, myColKey1(colKey1), myColKey2(colKey2), myColValue(colValue)
|
||||
{}
|
||||
: myDb{db}, myTableName{tableName},
|
||||
myColKey1{colKey1}, myColKey2{colKey2}, myColValue{colValue}
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
shared_ptr<KeyValueRepository> CompositeKeyValueRepositorySqlite::get(const string& key)
|
||||
|
@ -46,7 +48,7 @@ bool CompositeKeyValueRepositorySqlite::has(const string& key)
|
|||
.bind(1, key.c_str());
|
||||
|
||||
if (!myStmtCountSet->step())
|
||||
throw new SqliteError("count failed");
|
||||
throw SqliteError("count failed");
|
||||
|
||||
Int32 rowCount = myStmtCountSet->columnInt(0);
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ void SqliteDatabase::exec(const string& sql, T arg1, Ts... args)
|
|||
char buffer[512];
|
||||
|
||||
if (snprintf(buffer, 512, sql.c_str(), arg1, args...) >= 512)
|
||||
throw new runtime_error("SQL statement too long");
|
||||
throw runtime_error("SQL statement too long");
|
||||
|
||||
exec(buffer);
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ void StellaDb::migrate()
|
|||
stringstream ss;
|
||||
ss << "invalid database version " << version;
|
||||
|
||||
throw new SqliteError(ss.str());
|
||||
throw SqliteError(ss.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue