relaxis: improve error handling some
This commit is contained in:
		
							parent
							
								
									551e30b098
								
							
						
					
					
						commit
						13dfb9b1f0
					
				
					 1 changed files with 38 additions and 30 deletions
				
			
		| 
						 | 
				
			
			@ -36,10 +36,7 @@ int main(int argc, char** argv)
 | 
			
		|||
	if(!checkDir(outDir))
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	int arg = 1;
 | 
			
		||||
	try
 | 
			
		||||
	{
 | 
			
		||||
		for(; arg < argc; ++arg)
 | 
			
		||||
	for(int arg = 1; arg < argc; ++arg)
 | 
			
		||||
	{
 | 
			
		||||
		if(ignoreArgs.find(arg) != ignoreArgs.end())
 | 
			
		||||
			continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -48,10 +45,14 @@ int main(int argc, char** argv)
 | 
			
		|||
		std::cout<<"Loaded "<<argv[arg]<<" file has "<<file.getProjectCount()<<" project(s)\n";
 | 
			
		||||
 | 
			
		||||
		for(size_t i = 0; i < file.getProjectCount(); ++i)
 | 
			
		||||
		{
 | 
			
		||||
			try
 | 
			
		||||
			{
 | 
			
		||||
				rlx::Project project = file.getProject(i);
 | 
			
		||||
				std::cout<<"Project "<<i<<" has "<<project.getSpectraCount()<<" spectra\n";
 | 
			
		||||
				for(size_t j = 0; j < project.getSpectraCount(); ++j)
 | 
			
		||||
				{
 | 
			
		||||
					try
 | 
			
		||||
					{
 | 
			
		||||
						rlx::Spectra spectra = project.getSpectra(j);
 | 
			
		||||
						if(!spectra.fitted)
 | 
			
		||||
| 
						 | 
				
			
			@ -71,12 +72,19 @@ int main(int argc, char** argv)
 | 
			
		|||
						data.id = std::to_string(spectra.id);
 | 
			
		||||
						saveData("relaxis", data, outDir, argv[arg]);
 | 
			
		||||
					}
 | 
			
		||||
					catch(const eis::file_error& err)
 | 
			
		||||
					{
 | 
			
		||||
						std::cerr<<"error spectra " <<i<<" from file "<<argv[arg]<<" librelaxisloaderpp: "<<err.what()<<std::endl;
 | 
			
		||||
						continue;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			catch(const eis::file_error& err)
 | 
			
		||||
			{
 | 
			
		||||
				std::cerr<<"error reading file "<<argv[arg]<<" librelaxisloaderpp: "<<err.what()<<std::endl;
 | 
			
		||||
		return 1;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue