Commit 37df8685 authored by Kim Oyama's avatar Kim Oyama
Browse files

In ProjectionFactory, updated error messages to append to previous errors...

In ProjectionFactory, updated error messages to append to previous errors instead of throwing them out. Fixes #988.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@5700 41f8697f-d340-4b68-9986-7bafba869bb8
parent 4a2f781c
Loading
Loading
Loading
Loading
+2 −2
Changes for isis/src/base/objs/ProjectionFactory/ProjectionFactory.cpp: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ namespace Isis {
      catch(IException &e) {
        QString msg = "Unsupported projection, unable to find plugin for [" +
                     proj + "]";
        throw IException(IException::Unknown, msg, _FILEINFO_);
        throw IException(e, IException::Unknown, msg, _FILEINFO_);
      }

      // Now cast that pointer in the proper way
@@ -162,7 +162,7 @@ namespace Isis {
      catch(IException &e) {
        QString msg = "Unsupported projection, unable to find plugin for [" +
                      proj + "]";
        throw IException(IException::Unknown, msg, _FILEINFO_);
        throw IException(e, IException::Unknown, msg, _FILEINFO_);
      }

      // Now cast that pointer in the proper way
+2 −0
Changes for isis/src/base/objs/ProjectionFactory/ProjectionFactory.h: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -82,6 +82,8 @@ namespace Isis {
   *                           from the MinimumY to the MaximumY are at least one pixel resolution.
   *                           This ensures that the created cube will have at least one sample and
   *                           at least one line. References #775.
   *  @history 2014-01-16 Kimberly Oyama - Updated the error messages for unsupported projections
   *                          to include the source of the error. Fixes #988.
   */
  class ProjectionFactory {
    public:
+5 −0
Changes for isis/src/base/objs/ProjectionFactory/ProjectionFactory.truth: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -67,3 +67,8 @@ Object = IsisCube
  End_Group
End_Object
End

Test for ProjectionFactory's Create with unsupported projection
**I/O ERROR** Unable to initialize Projection information from group [Mapping].
**ERROR** Unsupported projection, unable to find plugin for [UnsupportedProjection].
**ERROR** Unable to find PVL group [UnsupportedProjection] in file [/work/projects/isis/latest/m01894/isis/lib/Projection.plugin].
+25 −0
Changes for isis/src/base/objs/ProjectionFactory/unitTest.cpp: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -108,6 +108,31 @@ int main(int argc, char *argv[]) {
  catch(IException &e) {
    e.print();
  }
  try {
    cout << endl << "Test for ProjectionFactory's Create with unsupported projection" << endl;

    Pvl lab;
    lab.addGroup(PvlGroup("Mapping"));
    PvlGroup &mapGroup = lab.findGroup("Mapping");
    mapGroup += PvlKeyword("EquatorialRadius", toString(3396190.0));
    mapGroup += PvlKeyword("PolarRadius", toString(3376200.0));

    mapGroup += PvlKeyword("LatitudeType", "Planetographic");
    mapGroup += PvlKeyword("LongitudeDirection", "PositiveEast");
    mapGroup += PvlKeyword("LongitudeDomain", toString(360));

    mapGroup += PvlKeyword("ProjectionName", "UnsupportedProjection");
    mapGroup += PvlKeyword("CenterLongitude", toString(220.0));
    mapGroup += PvlKeyword("PixelResolution", toString(2000.0));
    mapGroup += PvlKeyword("UpperLeftCornerX", toString(-18000.0));
    mapGroup += PvlKeyword("UpperLeftCornerY", toString(2062000.0));

    TProjection *proj = (TProjection *) ProjectionFactory::Create(lab);
    proj->SetWorld(245.0, 355.0);
  }
  catch(IException &e) {
    e.print();
  }
}

void doit(Pvl &lab) {