mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 16:40:07 +02:00
Bug2513: Disk exhaustion error message should be as was pre-Unitary
This commit is contained in:
parent
0c4514efb0
commit
2389b191f6
@ -17,6 +17,7 @@ Paul Licameli -- split from ProjectFileIO.cpp
|
|||||||
|
|
||||||
#include "Internat.h"
|
#include "Internat.h"
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
|
#include "FileException.h"
|
||||||
|
|
||||||
// Configuration to provide "safe" connections
|
// Configuration to provide "safe" connections
|
||||||
static const char *SafeConfig =
|
static const char *SafeConfig =
|
||||||
@ -157,6 +158,20 @@ bool DBConnection::Close()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[noreturn]] void DBConnection::ThrowException( bool write ) const
|
||||||
|
{
|
||||||
|
// Sqlite3 documentation says returned character string
|
||||||
|
// does NOT require freeing by us.
|
||||||
|
wxString dbName{ sqlite3_db_filename(mDB, "main") };
|
||||||
|
// Now we have an absolute path. Throw a message box exception that
|
||||||
|
// formats a helpful message just as used to be done before sqlite3
|
||||||
|
// was used for projects.
|
||||||
|
throw FileException{
|
||||||
|
write ? FileException::Cause::Write : FileException::Cause::Read,
|
||||||
|
dbName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
bool DBConnection::SafeMode(const char *schema /* = "main" */)
|
bool DBConnection::SafeMode(const char *schema /* = "main" */)
|
||||||
{
|
{
|
||||||
return ModeConfig(mDB, schema, SafeConfig);
|
return ModeConfig(mDB, schema, SafeConfig);
|
||||||
|
@ -35,6 +35,11 @@ public:
|
|||||||
bool Open(const char *fileName);
|
bool Open(const char *fileName);
|
||||||
bool Close();
|
bool Close();
|
||||||
|
|
||||||
|
//! throw and show appropriate message box
|
||||||
|
[[noreturn]] void ThrowException(
|
||||||
|
bool write //!< If true, a database update failed; if false, only a SELECT failed
|
||||||
|
) const;
|
||||||
|
|
||||||
bool SafeMode(const char *schema = "main");
|
bool SafeMode(const char *schema = "main");
|
||||||
bool FastMode(const char *schema = "main");
|
bool FastMode(const char *schema = "main");
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ size_t SqliteSampleBlock::GetBlob(void *dest,
|
|||||||
|
|
||||||
// Just showing the user a simple message, not the library error too
|
// Just showing the user a simple message, not the library error too
|
||||||
// which isn't internationalized
|
// which isn't internationalized
|
||||||
throw SimpleMessageBoxException{ XO("Failed to retrieve project data") };
|
Conn()->ThrowException( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve returned data
|
// Retrieve returned data
|
||||||
@ -583,7 +583,7 @@ void SqliteSampleBlock::Load(SampleBlockID sbid)
|
|||||||
|
|
||||||
// Just showing the user a simple message, not the library error too
|
// Just showing the user a simple message, not the library error too
|
||||||
// which isn't internationalized
|
// which isn't internationalized
|
||||||
throw SimpleMessageBoxException{ XO("Failed to retrieve sample block") };
|
Conn()->ThrowException( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve returned data
|
// Retrieve returned data
|
||||||
@ -641,7 +641,7 @@ void SqliteSampleBlock::Commit()
|
|||||||
|
|
||||||
// Just showing the user a simple message, not the library error too
|
// Just showing the user a simple message, not the library error too
|
||||||
// which isn't internationalized
|
// which isn't internationalized
|
||||||
throw SimpleMessageBoxException{ XO("Failed to add sample block") };
|
Conn()->ThrowException( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve returned data
|
// Retrieve returned data
|
||||||
@ -690,7 +690,7 @@ void SqliteSampleBlock::Delete()
|
|||||||
|
|
||||||
// Just showing the user a simple message, not the library error too
|
// Just showing the user a simple message, not the library error too
|
||||||
// which isn't internationalized
|
// which isn't internationalized
|
||||||
throw SimpleMessageBoxException{ XO("Failed to delete sample block") };
|
Conn()->ThrowException( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear statement bindings and rewind statement
|
// Clear statement bindings and rewind statement
|
||||||
|
Loading…
x
Reference in New Issue
Block a user