From 12d9a159dcb92a1c41c687c8c1655a0f32d31a6f Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 11 Feb 2019 12:10:47 +0000 Subject: [PATCH] ENH: Function1: better error message. Fixes #1200. --- .../Function1/Function1/Function1New.C | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1New.C b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1New.C index 96c7dad4ea..1fa65b93c5 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1New.C +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1New.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -52,13 +52,13 @@ Foam::autoPtr> Foam::Function1::New if (!cstrIter.found()) { - FatalErrorInFunction + FatalIOErrorInFunction(dict) << "Unknown Function1 type " << Function1Type << " for Function1 " << entryName << nl << nl << "Valid Function1 types :" << nl << dictionaryConstructorTablePtr_->sortedToc() << nl - << exit(FatalError); + << exit(FatalIOError); } return cstrIter()(entryName, coeffsDict); @@ -90,23 +90,31 @@ Foam::autoPtr> Foam::Function1::New Function1Type = firstToken.wordToken(); } } - else + else if (redirectType != word::null) { Function1Type = redirectType; } - + else + { + FatalIOErrorInFunction(dict) + << "Cannot find specification for Function1 " + << entryName << nl << nl + << "Valid Function1 types :" << nl + << dictionaryConstructorTablePtr_->sortedToc() << nl + << exit(FatalIOError); + } auto cstrIter = dictionaryConstructorTablePtr_->cfind(Function1Type); if (!cstrIter.found()) { - FatalErrorInFunction + FatalIOErrorInFunction(dict) << "Unknown Function1 type " << Function1Type << " for Function1 " << entryName << nl << nl << "Valid Function1 types :" << nl << dictionaryConstructorTablePtr_->sortedToc() << nl - << exit(FatalError); + << exit(FatalIOError); } return cstrIter()