scanType();
if (!scanId() || !scanDate()) {
delete[] _data;
- throw sg_io_exception("metar data bogus (" + _url + ')');
+ throw sg_io_exception("metar data bogus ", sg_location(_url));
}
scanModifier();
if (_grpcount < 4) {
delete[] _data;
- throw sg_io_exception("metar data incomplete (" + _url + ')');
+ throw sg_io_exception("metar data incomplete ", sg_location(_url));
}
_url = "";
sock->set_timeout(10000);
if (!sock->open(SG_IO_OUT)) {
delete sock;
- throw sg_io_exception("cannot connect to " + host);
+ throw sg_io_exception("cannot connect to ", sg_location(host));
}
string get = "GET ";
char *b = buf;
scanBoundary(&b);
if (*b == '<')
- throw sg_io_exception("no metar data available from " + _url);
+ throw sg_io_exception("no metar data available from ",
+ sg_location(_url));
char *metar = new char[strlen(b) + 2]; // make room for " \0"
strcpy(metar, b);
} catch (const sg_exception &ex) {
SG_LOG( SG_INPUT, SG_ALERT, "Error reading materials: "
<< ex.getMessage() );
- throw ex;
+ throw;
}
int nMaterials = materials.nChildren();
ssgTexturePath((char *)texturepath.c_str());
model = (ssgBranch *)ssgLoad((char *)modelpath.c_str());
if (model == 0)
- throw sg_exception("Failed to load 3D model");
+ throw sg_io_exception("Failed to load 3D model",
+ sg_location(modelpath.str()));
}
// Set up the alignment node
ssgTransform * alignmainmodel = new ssgTransform;
if (buffer == AL_NONE) {
ALenum error = alutGetError ();
print_openal_error("constructor (alutCreateBufferFromFile)");
- throw sg_exception("Failed to load wav file: "+string(alutGetErrorString (error)));
+ throw sg_io_exception("Failed to load wav file: ",
+ sg_location(string(alutGetErrorString (error))));
}
#else
ALfloat freqf;
data = alutLoadMemoryFromFile(samplepath.c_str(), &format, &size, &freqf );
if (data == NULL) {
- throw sg_exception("Failed to load wav file.");
+ throw sg_io_exception("Failed to load wav file.",
+ sg_location(samplepath.str()));
}
freq = (ALsizei)freqf;
#else
&format, &data, &size, &freq, &loop );
# endif
if ( print_openal_error("constructor (alutLoadWAVFile)") ) {
- throw sg_exception("Failed to load wav file.");
+ throw sg_io_exception("Failed to load wav file.",
+ sg_location(samplepath.str()));
}
#endif
if (input.good()) {
try {
readXML(input, visitor, path);
- } catch (sg_io_exception &e) {
+ } catch (sg_io_exception &) {
input.close();
- throw e;
- } catch (sg_throwable &t) {
+ throw;
+ } catch (sg_throwable &) {
input.close();
- throw t;
+ throw;
}
} else {
throw sg_io_exception("Failed to open file", sg_location(path),