1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 07:13:49 +01:00

Define an AudacityException subclass for unready on-demand data

This commit is contained in:
Paul Licameli
2016-12-25 10:47:08 -05:00
parent acf3c018bb
commit 9fde75268f
6 changed files with 80 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
//
// NotYetAvailableException.cpp
//
//
// Created by Paul Licameli on 12/25/16.
//
//
#include "../Audacity.h"
#include "NotYetAvailableException.h"
NotYetAvailableException::~NotYetAvailableException()
{
}
std::unique_ptr< AudacityException > NotYetAvailableException::Move()
{
return std::unique_ptr< AudacityException >
{ safenew NotYetAvailableException{ std::move( *this ) } };
}
wxString NotYetAvailableException::ErrorMessage() const
{
return wxString::Format(
_("This operation cannot be done until importation of %s completes."),
mFileName.GetFullName()
);
}

View File

@@ -0,0 +1,34 @@
//
// NotYetAvailableException.h
//
//
// Created by Paul Licameli on 12/25/16.
//
//
#ifndef __AUDACITY_NOT_YET_AVAILABLE_EXCEPTION__
#define __AUDACITY_NOT_YET_AVAILABLE_EXCEPTION__
#include "../FileException.h"
#include <wx/filename.h>
// This exception can be thrown when attempting read of on-demand block files
// that have not yet completed loading.
class NotYetAvailableException final : public FileException
{
public:
NotYetAvailableException( const wxFileName &fileName )
: FileException{ Cause::Read, fileName } {}
NotYetAvailableException(NotYetAvailableException &&that)
: FileException( std::move( that ) ) {}
~NotYetAvailableException();
protected:
std::unique_ptr< AudacityException > Move() override;
wxString ErrorMessage() const override;
private:
wxFileName mFileName;
};
#endif