+ogg_error::ogg_error(const std::string &func, int code):
+ runtime_error(format("%s: %s", func, get_message(code)))
+{ }
+
+string ogg_error::get_message(int code)
+{
+ switch(code)
+ {
+ case OV_FALSE: return "No data available";
+ case OV_HOLE: return "Missing or corrupt data";
+ case OV_EREAD: return "Read error";
+ case OV_EFAULT: return "Internal inconsistency";
+ case OV_EIMPL: return "Not implemented";
+ case OV_EINVAL: return "Invalid argument";
+ case OV_ENOTVORBIS: return "Not Vorbis data";
+ case OV_EBADHEADER: return "Corrupt Vorbis header";
+ case OV_EVERSION: return "Unsupported version";
+ case OV_EBADLINK: return "Bad link";
+ case OV_ENOSEEK: return "Stream is not seekable";
+ default: return format("Unknown error (%d)", code);
+ }
+}
+
+