Skip to content

Commit

Permalink
more elegant exception handling in exrmaketiled (AcademySoftwareFound…
Browse files Browse the repository at this point in the history
…ation#841)

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
  • Loading branch information
peterhillman committed Dec 6, 2020
1 parent 1472578 commit 9bda463
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions OpenEXR/exrmaketiled/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,31 +393,32 @@ main(int argc, char **argv)

int exitStatus = 0;

//
// check input
//
try
{
MultiPartInputFile input (inFile);
int parts = input.parts();
//
// check input
//
{
MultiPartInputFile input (inFile);
int parts = input.parts();

if (partnum < 0 || partnum >= parts){
cerr << "ERROR: you asked for part " << partnum << " in " << inFile;
cerr << ", which only has " << parts << " parts\n";
exit(1);
}
if (partnum < 0 || partnum >= parts){
cerr << "ERROR: you asked for part " << partnum << " in " << inFile;
cerr << ", which only has " << parts << " parts\n";
exit(1);
}

Header h = input.header (partnum);
if (h.type() == DEEPTILE || h.type() == DEEPSCANLINE)
{
cerr << "Cannot make tile for deep data" << endl;
exit(1);
}

Header h = input.header (partnum);
if (h.type() == DEEPTILE || h.type() == DEEPSCANLINE)
{
cerr << "Cannot make tile for deep data" << endl;
exit(1);
}

}


try
{
makeTiled (inFile, outFile, partnum,
mode, roundingMode, compression,
tileSizeX, tileSizeY,
Expand Down

0 comments on commit 9bda463

Please sign in to comment.