1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-16 15:41:11 +02:00

Bug2515: When WAV export fails to write file, give better message

This commit is contained in:
Paul Licameli
2020-08-27 22:02:40 -04:00
parent 70175acaf4
commit 7d359a6640

View File

@@ -639,6 +639,8 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
if (static_cast<size_t>(samplesWritten) != numSamples) {
char buffer2[1000];
sf_error_str(sf.get(), buffer2, 1000);
//Used to give this error message
#if 0
AudacityMessageBox(
XO(
/* i18n-hint: %s will be the error message from libsndfile, which
@@ -646,6 +648,15 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
* error" */
"Error while writing %s file (disk full?).\nLibsndfile says \"%s\"")
.Format( formatStr, wxString::FromAscii(buffer2) ));
#else
// But better to give the same error message as for
// other cases of disk exhaustion.
// The thrown exception doesn't escape but GuardedCall
// will enqueue a message.
GuardedCall([&fName]{
throw FileException{
FileException::Cause::Write, fName }; });
#endif
updateResult = ProgressResult::Cancelled;
break;
}