Commit 15973b78 authored by claes's avatar claes

a throw added in updateObject

parent 3fa82e1e
/* /*
* Proview $Id: wb_vrepdb.cpp,v 1.42 2006-05-21 22:30:50 lw Exp $ * Proview $Id: wb_vrepdb.cpp,v 1.43 2006-05-22 09:38:08 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -1606,27 +1606,26 @@ void wb_vrepdb::updateMeta() ...@@ -1606,27 +1606,26 @@ void wb_vrepdb::updateMeta()
printf("vrepdb: %s\n", e.what()); printf("vrepdb: %s\n", e.what());
return; return;
} catch (wb_error &e) { } catch (wb_error &e) {
printf("vrepdb: %s\n", e.what()); printf("vrepdb: %s\n", e.what().c_str());
return; return;
} }
if (m_classCount == 0) if (m_classCount != 0) {
return;
char buff[256]; char buff[256];
sprintf(buff, "A total of %d object instances of %d classes were updated", sprintf(buff, "A total of %d object instances of %d classes were updated",
m_totalInstanceCount, m_classCount); m_totalInstanceCount, m_classCount);
MsgWindow::message('I', buff); MsgWindow::message('I', buff);
pwr_tStatus sts = 0; pwr_tStatus sts = 0;
commit(&sts); commit(&sts);
if (sts) { if (sts) {
MsgWindow::message(co_error(sts), "Could not save class updates to database"); MsgWindow::message(co_error(sts), "Could not save class updates to database");
return; return;
}
} }
m_merep->copyFiles(m_fileName, m_erep->merep()); m_merep->copyFiles(m_fileName, m_erep->merep());
delete m_merep; delete m_merep;
m_merep = new wb_merep(m_fileName, m_erep, this); m_merep = new wb_merep(m_fileName, m_erep, this);
...@@ -1721,7 +1720,7 @@ void wb_vrepdb::updateObject(pwr_tOid oid, pwr_tCid cid) ...@@ -1721,7 +1720,7 @@ void wb_vrepdb::updateObject(pwr_tOid oid, pwr_tCid cid)
time_AtoAscii(&o_time, time_eFormat_DateAndTime, o_timbuf, sizeof(o_timbuf)); time_AtoAscii(&o_time, time_eFormat_DateAndTime, o_timbuf, sizeof(o_timbuf));
sprintf(buff, "Class \"%s\" [%s], %d instance%s, does not exist in global scope", sprintf(buff, "Class \"%s\" [%s], %d instance%s, does not exist in global scope",
o_crep->name(), o_timbuf, m_instanceCount, (m_instanceCount == 1 ? "" : "s")); o_crep->name(), o_timbuf, m_instanceCount, (m_instanceCount == 1 ? "" : "s"));
} else { } else if ( o_crep != 0) {
o_time = o_crep->ohTime(); o_time = o_crep->ohTime();
n_time = n_crep->ohTime(); n_time = n_crep->ohTime();
time_AtoAscii(&o_time, time_eFormat_DateAndTime, o_timbuf, sizeof(o_timbuf)); time_AtoAscii(&o_time, time_eFormat_DateAndTime, o_timbuf, sizeof(o_timbuf));
...@@ -1734,6 +1733,8 @@ void wb_vrepdb::updateObject(pwr_tOid oid, pwr_tCid cid) ...@@ -1734,6 +1733,8 @@ void wb_vrepdb::updateObject(pwr_tOid oid, pwr_tCid cid)
} }
o_crep = m_merep->cdrep(&sts, cid); o_crep = m_merep->cdrep(&sts, cid);
if (o_crep == 0)
throw wb_error(sts);
n_crep = m_merepCheck->cdrep(&sts, cid); n_crep = m_merepCheck->cdrep(&sts, cid);
if (n_crep == 0) { if (n_crep == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment