Show proper error at db connect fail
This commit is contained in:
parent
0e30335a7a
commit
76597fce37
1 changed files with 13 additions and 6 deletions
|
|
@ -60,6 +60,8 @@ namespace TShockAPI.DB
|
|||
public static QueryResult QueryReader(this IDbConnection olddb, string query, params object[] args)
|
||||
{
|
||||
var db = olddb.CloneEx();
|
||||
try
|
||||
{
|
||||
db.Open();
|
||||
using (var com = db.CreateCommand())
|
||||
{
|
||||
|
|
@ -70,6 +72,11 @@ namespace TShockAPI.DB
|
|||
return new QueryResult(db, com.ExecuteReader());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Fatal TShock initialization exception: failed to connect to MySQL database. See inner exception for details.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static QueryResult QueryReaderDict(this IDbConnection olddb, string query, Dictionary<string, object> values)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue