Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitri Naumov
ogs
Commits
f7bc43b6
Commit
f7bc43b6
authored
6 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[BL] ConfigTree: Fix warning "catch by value".
parent
39475462
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
BaseLib/ConfigTree-impl.h
+12
-6
12 additions, 6 deletions
BaseLib/ConfigTree-impl.h
BaseLib/ConfigTreeUtil.cpp
+7
-4
7 additions, 4 deletions
BaseLib/ConfigTreeUtil.cpp
with
19 additions
and
10 deletions
BaseLib/ConfigTree-impl.h
+
12
−
6
View file @
f7bc43b6
...
@@ -120,14 +120,20 @@ peekConfigParameter(std::string const& param) const
...
@@ -120,14 +120,20 @@ peekConfigParameter(std::string const& param) const
{
{
checkKeyname
(
param
);
checkKeyname
(
param
);
if
(
auto
p
=
_tree
->
get_child_optional
(
param
))
{
if
(
auto
p
=
_tree
->
get_child_optional
(
param
))
try
{
{
try
{
return
p
->
get_value
<
T
>
();
return
p
->
get_value
<
T
>
();
}
catch
(
boost
::
property_tree
::
ptree_bad_data
)
{
error
(
"Value for key <"
+
param
+
"> `"
+
shortString
(
p
->
data
())
+
"' not convertible to the desired type."
);
}
}
}
else
{
catch
(
boost
::
property_tree
::
ptree_bad_data
const
&
)
{
error
(
"Value for key <"
+
param
+
"> `"
+
shortString
(
p
->
data
())
+
"' not convertible to the desired type."
);
}
}
else
{
error
(
"Key <"
+
param
+
"> has not been found"
);
error
(
"Key <"
+
param
+
"> has not been found"
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
BaseLib/ConfigTreeUtil.cpp
+
7
−
4
View file @
f7bc43b6
...
@@ -54,13 +54,16 @@ makeConfigTree(const std::string& filepath, const bool be_ruthless,
...
@@ -54,13 +54,16 @@ makeConfigTree(const std::string& filepath, const bool be_ruthless,
// note: Trimming whitespace and ignoring comments is crucial in order
// note: Trimming whitespace and ignoring comments is crucial in order
// for our configuration tree implementation to work!
// for our configuration tree implementation to work!
try
{
try
{
read_xml
(
filepath
,
ptree
,
read_xml
(
filepath
,
ptree
,
boost
::
property_tree
::
xml_parser
::
no_comments
|
boost
::
property_tree
::
xml_parser
::
no_comments
|
boost
::
property_tree
::
xml_parser
::
trim_whitespace
);
boost
::
property_tree
::
xml_parser
::
trim_whitespace
);
}
catch
(
boost
::
property_tree
::
xml_parser_error
e
)
{
}
catch
(
boost
::
property_tree
::
xml_parser_error
const
&
e
)
{
OGS_FATAL
(
"Error while parsing XML file `%s' at line %lu: %s."
,
OGS_FATAL
(
"Error while parsing XML file `%s' at line %lu: %s."
,
e
.
filename
().
c_str
(),
e
.
line
(),
e
.
message
().
c_str
());
e
.
filename
().
c_str
(),
e
.
line
(),
e
.
message
().
c_str
());
}
}
DBUG
(
"Project configuration from file
\'
%s
\'
read."
,
filepath
.
c_str
());
DBUG
(
"Project configuration from file
\'
%s
\'
read."
,
filepath
.
c_str
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment