Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
clapp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
libclapp
clapp
Commits
d8e8af63
Commit
d8e8af63
authored
4 years ago
by
Martin Wölzer
Browse files
Options
Downloads
Patches
Plain Diff
src/clapp/value.cpp: added quotes for better readability to exception messages
parent
a39a9931
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/clapp/value.cpp
+12
-12
12 additions, 12 deletions
src/clapp/value.cpp
with
12 additions
and
12 deletions
src/clapp/value.cpp
+
12
−
12
View file @
d8e8af63
...
...
@@ -125,12 +125,12 @@ float clapp::value::convert_value<float>(const std::string_view param) {
return
std
::
stof
(
std
::
string
{
param
},
nullptr
);
}
catch
(
std
::
out_of_range
&
e
)
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
param
<<
" is out of float-range. ("
ss
<<
"convert_value: value
'
"
<<
param
<<
"
'
is out of float-range. ("
<<
e
.
what
()
<<
")"
;
throw
clapp
::
exception
::
out_of_range_t
{
ss
.
str
()};
}
catch
(
std
::
invalid_argument
&
e
)
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
param
<<
" is invalid. ("
<<
e
.
what
()
ss
<<
"convert_value: value
'
"
<<
param
<<
"
'
is invalid. ("
<<
e
.
what
()
<<
")"
;
throw
clapp
::
exception
::
invalid_value_t
{
ss
.
str
()};
}
...
...
@@ -142,12 +142,12 @@ double clapp::value::convert_value<double>(const std::string_view param) {
return
std
::
stod
(
std
::
string
{
param
},
nullptr
);
}
catch
(
std
::
out_of_range
&
e
)
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
param
<<
" is out of double-range. ("
ss
<<
"convert_value: value
'
"
<<
param
<<
"
'
is out of double-range. ("
<<
e
.
what
()
<<
")"
;
throw
clapp
::
exception
::
out_of_range_t
{
ss
.
str
()};
}
catch
(
std
::
invalid_argument
&
e
)
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
param
<<
" is invalid. ("
<<
e
.
what
()
ss
<<
"convert_value: value
'
"
<<
param
<<
"
'
is invalid. ("
<<
e
.
what
()
<<
")"
;
throw
clapp
::
exception
::
invalid_value_t
{
ss
.
str
()};
}
...
...
@@ -168,7 +168,7 @@ void clapp::path_exists_t::validate(const clapp::fs::path& path,
const
std
::
string
&
param_name
)
{
if
(
!
clapp
::
fs
::
exists
(
path
))
{
std
::
stringstream
ss
;
ss
<<
"CLI value "
<<
path
<<
" for '"
<<
param_name
ss
<<
"CLI value
'
"
<<
path
<<
"
'
for '"
<<
param_name
<<
"' does not exist."
;
throw
clapp
::
exception
::
path_does_not_exist_t
(
ss
.
str
());
}
...
...
@@ -186,20 +186,20 @@ static T convert_uint(const std::string_view param) {
if
(
value
>
std
::
numeric_limits
<
T
>::
max
())
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
value
<<
" is bigger than max "
ss
<<
"convert_value: value
'
"
<<
value
<<
"
'
is bigger than max "
<<
std
::
numeric_limits
<
T
>::
max
();
throw
clapp
::
exception
::
out_of_range_t
{
ss
.
str
()};
}
return
static_cast
<
T
>
(
value
);
}
catch
(
std
::
out_of_range
&
e
)
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
param
<<
" is out of range. ("
ss
<<
"convert_value: value
'
"
<<
param
<<
"
'
is out of range. ("
<<
std
::
numeric_limits
<
T
>::
min
()
<<
" and "
<<
std
::
numeric_limits
<
T
>::
max
()
<<
", "
<<
e
.
what
()
<<
")"
;
throw
clapp
::
exception
::
out_of_range_t
{
ss
.
str
()};
}
catch
(
std
::
invalid_argument
&
e
)
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
param
<<
" is invalid. ("
<<
e
.
what
()
ss
<<
"convert_value: value
'
"
<<
param
<<
"
'
is invalid. ("
<<
e
.
what
()
<<
")"
;
throw
clapp
::
exception
::
invalid_value_t
{
ss
.
str
()};
}
...
...
@@ -216,27 +216,27 @@ static T convert_int(const std::string_view param) {
if
(
value
>
std
::
numeric_limits
<
T
>::
max
())
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
value
<<
" is bigger than max "
ss
<<
"convert_value: value
'
"
<<
value
<<
"
'
is bigger than max "
<<
std
::
numeric_limits
<
T
>::
max
();
throw
clapp
::
exception
::
out_of_range_t
{
ss
.
str
()};
}
if
(
value
<
std
::
numeric_limits
<
T
>::
min
())
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
value
<<
" is smaller than min "
ss
<<
"convert_value: value
'
"
<<
value
<<
"
'
is smaller than min "
<<
std
::
numeric_limits
<
T
>::
max
();
throw
clapp
::
exception
::
out_of_range_t
{
ss
.
str
()};
}
return
static_cast
<
T
>
(
value
);
}
catch
(
std
::
out_of_range
&
e
)
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
param
<<
" is out of range. ("
ss
<<
"convert_value: value
'
"
<<
param
<<
"
'
is out of range. ("
<<
std
::
numeric_limits
<
T
>::
min
()
<<
" and "
<<
std
::
numeric_limits
<
T
>::
max
()
<<
", "
<<
e
.
what
()
<<
")"
;
throw
clapp
::
exception
::
out_of_range_t
{
ss
.
str
()};
}
catch
(
std
::
invalid_argument
&
e
)
{
std
::
stringstream
ss
;
ss
<<
"convert_value: value "
<<
param
<<
" is invalid. ("
<<
e
.
what
()
ss
<<
"convert_value: value
'
"
<<
param
<<
"
'
is invalid. ("
<<
e
.
what
()
<<
")"
;
throw
clapp
::
exception
::
invalid_value_t
{
ss
.
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