Handle unsupported file extension exception

pull/14/head
Dimitri Diakopoulos 10 years ago
parent 3622b0ea08
commit 25e43204d0

@ -69,11 +69,13 @@ int main()
//Block-split-stereo-ima4-reaper.wav //Block-split-stereo-ima4-reaper.wav
//auto result = loader.Load(fileData, "test_data/ad_hoc/TestBeat_44_16_mono-ima4-reaper.wav"); //auto result = loader.Load(fileData, "test_data/ad_hoc/TestBeat_44_16_mono-ima4-reaper.wav");
auto result = loader.Load(fileData, "test_data/ad_hoc/TestBeat_44_16_stereo-ima4-reaper.wav"); loader.Load(fileData, "test_data/ad_hoc/TestBeat_44_16_stereo-ima4-reaper.wavp");
std::cout << "[Debug] Loader Status: " << result << std::endl;
} }
catch (std::exception e) catch(const UnsupportedExtensionException & e)
{
std::cerr << "Caught: " << e.what() << std::endl;
}
catch (const std::exception & e)
{ {
std::cerr << "Caught: " << e.what() << std::endl; std::cerr << "Caught: " << e.what() << std::endl;
std::exit(1); std::exit(1);

@ -35,11 +35,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace nqr namespace nqr
{ {
struct UnsupportedExtensionException : public std::runtime_error struct UnsupportedExtensionException : public std::runtime_error
{ {
UnsupportedExtensionException() : std::runtime_error("Unsupported file extension") {} UnsupportedExtensionException() : std::runtime_error("Unsupported file extension") {}
}; };
// Tofix:
// Individual decoder classes will throw std::exceptions for bad things, // Individual decoder classes will throw std::exceptions for bad things,
// but NyquistIO implements this enum for high-level error notifications. // but NyquistIO implements this enum for high-level error notifications.
enum IOError enum IOError

Loading…
Cancel
Save