Skip to content

Commit 523887a

Browse files
committed
Made sure that the library components crash loudly when exception occurrs
1 parent 6d3854a commit 523887a

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

appln/main_xodr.cxx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ int main (int argc , char **argv)
1111

1212
xodr _odrive;
1313
_odrive.load(filename);
14-
_odrive.parse();
14+
15+
try{
16+
_odrive.parse();
17+
std::cout << "OpenDRIVE parse successfully " << _odrive.m_OpenDRIVE<< std::endl;
18+
}
19+
catch (std::exception &e)
20+
{
21+
std::cout << "ERROR :Exception .. " << e.what() << std::endl;
22+
}
1523

1624
_odrive.save("xodr_save.xml");
1725

appln/main_xosc.cxx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ int main (int argc , char **argv)
1111

1212
xosc _osc;
1313
_osc.load(filename);
14-
_osc.parse();
14+
try{
15+
_osc.parse();
16+
std::cout << "OpenSCENARIO parse successfully " << _osc.m_OpenSCENARIO<< std::endl;
17+
}
18+
catch (std::exception &e)
19+
{
20+
std::cout << "ERROR :Exception .. " << e.what() << std::endl;
21+
}
1522

1623
_osc.save("xosc_save.xml");
1724

src/xodr/xodr.cxx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,14 +2011,7 @@ void xodr::load(std::string xodrfilename )
20112011
}
20122012
void xodr::parse()
20132013
{
2014-
try {
2015-
m_OpenDRIVE = std::make_shared<OpenDRIVE>(m_root.child("OpenDRIVE"));
2016-
std::cout << "OpenDRIVE parse successfully " << m_OpenDRIVE<< std::endl;
2017-
}
2018-
catch (std::exception &e)
2019-
{
2020-
std::cout << "ERROR :Exception .. " << e.what() << std::endl;
2021-
}
2014+
m_OpenDRIVE = std::make_shared<OpenDRIVE>(m_root.child("OpenDRIVE"));
20222015
}
20232016
void xodr::save(std::string filename)
20242017
{

src/xosc/xosc.cxx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,14 +3428,7 @@ void xosc::load(std::string xoscfilename )
34283428
}
34293429
void xosc::parse()
34303430
{
3431-
try {
3432-
m_OpenSCENARIO = std::make_shared<OpenSCENARIO>(m_root.child("OpenSCENARIO"));
3433-
std::cout << "OpenSCENARIO parse successfully " << m_OpenSCENARIO<< std::endl;
3434-
}
3435-
catch (std::exception &e)
3436-
{
3437-
std::cout << "ERROR :Exception .. " << e.what() << std::endl;
3438-
}
3431+
m_OpenSCENARIO = std::make_shared<OpenSCENARIO>(m_root.child("OpenSCENARIO"));
34393432
}
34403433
void xosc::save(std::string filename)
34413434
{

0 commit comments

Comments
 (0)