mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-09 05:01:57 +01:00
Define an AudacityException subclass for assertion violations
This commit is contained in:
42
src/InconsistencyException.cpp
Normal file
42
src/InconsistencyException.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// InconsistencyException.cpp
|
||||
//
|
||||
//
|
||||
// Created by Paul Licameli on 11/27/16.
|
||||
//
|
||||
//
|
||||
|
||||
#include "Audacity.h"
|
||||
#include "InconsistencyException.h"
|
||||
|
||||
InconsistencyException::~InconsistencyException()
|
||||
{
|
||||
}
|
||||
|
||||
std::unique_ptr< AudacityException > InconsistencyException::Move()
|
||||
{
|
||||
return std::unique_ptr< AudacityException >
|
||||
{ safenew InconsistencyException{ std::move( *this ) } };
|
||||
}
|
||||
|
||||
wxString InconsistencyException::ErrorMessage() const
|
||||
{
|
||||
// Shorten the path
|
||||
wxString path { file };
|
||||
auto sub = wxString{ wxFILE_SEP_PATH } + "src" + wxFILE_SEP_PATH;
|
||||
auto index = path.Find(sub);
|
||||
if (index != wxNOT_FOUND)
|
||||
path = path.Mid(index + sub.size());
|
||||
|
||||
#ifdef __func__
|
||||
return wxString::Format(
|
||||
_("Internal error in %s at %s line %d.\nPlease inform the Audacity team at feedback@audacityteam.org."),
|
||||
func, path, line
|
||||
);
|
||||
#else
|
||||
return wxString::Format(
|
||||
_("Internal error at %s line %d.\nPlease inform the Audacity team at feedback@audacityteam.org."),
|
||||
path, line
|
||||
);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user