From d01b37a949a611bb0a31aeb46c284d54464d1a1c Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 18 Oct 2022 21:13:45 +0100 Subject: [PATCH] functionObjectList: Added error message for functionObject configuration file name not specified token: Changed parseError to use cerr rather than FatalIOError so that it can report errors when reading debug switches from the case controlDict at start-up. --- src/OpenFOAM/db/IOstreams/token/token.C | 7 +++--- .../functionObjectList/functionObjectList.C | 25 ++++++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/OpenFOAM/db/IOstreams/token/token.C b/src/OpenFOAM/db/IOstreams/token/token.C index af940afadb..10fb5c19e8 100644 --- a/src/OpenFOAM/db/IOstreams/token/token.C +++ b/src/OpenFOAM/db/IOstreams/token/token.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,9 +42,8 @@ namespace Foam void Foam::token::parseError(const char* expected) const { - FatalIOError - << "Parse error, expected a " << expected - << ", found \n " << info() << endl; + cerr<< "Parse error, expected a " << expected + << ", found \n " << info() << std::endl; } diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 30c736453a..85230c0c9c 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -246,12 +246,25 @@ bool Foam::functionObjectList::readFunctionObject if (path == fileName::null) { - FatalIOErrorInFunction(functionsDict) - << "Cannot find functionObject configuration file " - << funcType << nl << nl - << "Available configured functionObjects:" - << list() - << exit(FatalIOError); + if (funcType == word::null) + { + FatalIOErrorInFunction(functionsDict) + << "functionObject configuration file name not specified" + << nl << nl + << "Available configured functionObjects:" + << list() + << exit(FatalIOError); + } + else + { + FatalIOErrorInFunction(functionsDict) + << "Cannot find functionObject configuration file " + << funcType << nl << nl + << "Available configured functionObjects:" + << list() + << exit(FatalIOError); + } + return false; }