From 96d9ba5f8813e0bbc3a8b5ef0b036f365adec88a Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Thu, 25 Apr 2019 20:23:40 +0200 Subject: [PATCH] added some more specifc error codes. --- src/musrview.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/musrview.cpp b/src/musrview.cpp index e21ddab9..597ee51e 100644 --- a/src/musrview.cpp +++ b/src/musrview.cpp @@ -98,6 +98,7 @@ void musrview_syntax() */ int main(int argc, char *argv[]) { + int result = PMUSR_SUCCESS; bool show_syntax = false; int status; bool success = true; @@ -119,7 +120,7 @@ int main(int argc, char *argv[]) // check input arguments if (argc == 1) { musrview_syntax(); - return PMUSR_SUCCESS; + return PMUSR_SYNTAX_REQUEST; } for (int i=1; iIsAllDataAvailable(); if (!success) { std::cerr << std::endl << ">> musrview **ERROR** Couldn't read all data files, will quit ..." << std::endl; + result = PMUSR_DATA_FILE_READ_ERROR; } // generate the necessary histogramms for the view PRunListCollection *runListCollection = nullptr; - if (success) { + if (result == PMUSR_SUCCESS) { // feed all the necessary histogramms for the view runListCollection = new PRunListCollection(msrHandler, dataHandler); for (unsigned int i=0; iGetMsrRunList()->size(); i++) { @@ -293,13 +295,14 @@ int main(int argc, char *argv[]) if (!success) { std::cerr << std::endl << ">> musrview **ERROR** Couldn't handle run no " << i << " "; std::cerr << (*msrHandler->GetMsrRunList())[i].GetRunName()->Data(); + result = PMUSR_MSR_RUN_ERROR; break; } } } } - if (success) { + if (result == PMUSR_SUCCESS) { // generate Root application needed for PMusrCanvas if (graphicsOutput || asciiOutput) { argv[argc] = (char*)malloc(16*sizeof(char)); @@ -409,5 +412,5 @@ int main(int argc, char *argv[]) runListCollection = nullptr; } - return PMUSR_SUCCESS; + return result; }