Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
98b88497
Commit
98b88497
authored
May 5, 2023
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Simplify error message for invalid attribute type at reading
parent
7b3bdd4b
No related branches found
No related tags found
1 merge request
!176
Add HDF5 support
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/utils/HDF5.cpp
+1
-2
1 addition, 2 deletions
src/utils/HDF5.cpp
tests/test_HDF5.cpp
+1
-4
1 addition, 4 deletions
tests/test_HDF5.cpp
with
2 additions
and
6 deletions
src/utils/HDF5.cpp
+
1
−
2
View file @
98b88497
...
@@ -165,8 +165,7 @@ HDF5::_readAttribute(const HDFId<id_type>& id, const std::string& name, const Da
...
@@ -165,8 +165,7 @@ HDF5::_readAttribute(const HDFId<id_type>& id, const std::string& name, const Da
hid_t
attribute_type
=
H5Aget_type
(
attribute_id
);
hid_t
attribute_type
=
H5Aget_type
(
attribute_id
);
if
(
not
H5Tequal
(
attribute_type
,
type
))
{
if
(
not
H5Tequal
(
attribute_type
,
type
))
{
std
::
ostringstream
error_msg
;
std
::
ostringstream
error_msg
;
error_msg
<<
"invalid type for attribute '"
<<
rang
::
fgB
::
yellow
<<
name
<<
rang
::
fg
::
reset
<<
"' got "
error_msg
<<
"invalid type for attribute '"
<<
rang
::
fgB
::
yellow
<<
name
<<
rang
::
fg
::
reset
<<
"'"
;
<<
H5Aget_type
(
attribute_id
)
<<
" expecting "
<<
type
;
throw
NormalError
(
error_msg
.
str
());
throw
NormalError
(
error_msg
.
str
());
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/test_HDF5.cpp
+
1
−
4
View file @
98b88497
...
@@ -18,7 +18,6 @@ TEST_CASE("HDF5", "[utils]")
...
@@ -18,7 +18,6 @@ TEST_CASE("HDF5", "[utils]")
SECTION
(
"create file"
)
SECTION
(
"create file"
)
{
{
std
::
clog
<<
"filename = "
<<
filename
<<
'\n'
;
HDF5
::
FileId
file_id
=
HDF5
::
create
(
filename
);
HDF5
::
FileId
file_id
=
HDF5
::
create
(
filename
);
REQUIRE
(
file_id
>=
0
);
REQUIRE
(
file_id
>=
0
);
HDF5
::
close
(
file_id
);
HDF5
::
close
(
file_id
);
...
@@ -26,7 +25,6 @@ TEST_CASE("HDF5", "[utils]")
...
@@ -26,7 +25,6 @@ TEST_CASE("HDF5", "[utils]")
SECTION
(
"open file and add attributes"
)
SECTION
(
"open file and add attributes"
)
{
{
std
::
clog
<<
"filename = "
<<
filename
<<
'\n'
;
HDF5
::
FileId
file_id
=
HDF5
::
openFileRW
(
filename
);
HDF5
::
FileId
file_id
=
HDF5
::
openFileRW
(
filename
);
REQUIRE
(
file_id
>=
0
);
REQUIRE
(
file_id
>=
0
);
...
@@ -56,7 +54,6 @@ TEST_CASE("HDF5", "[utils]")
...
@@ -56,7 +54,6 @@ TEST_CASE("HDF5", "[utils]")
SECTION
(
"open file ro"
)
SECTION
(
"open file ro"
)
{
{
std
::
clog
<<
"filename = "
<<
filename
<<
'\n'
;
HDF5
::
FileId
file_id
=
HDF5
::
openFileRW
(
filename
);
HDF5
::
FileId
file_id
=
HDF5
::
openFileRW
(
filename
);
REQUIRE
(
file_id
>=
0
);
REQUIRE
(
file_id
>=
0
);
...
@@ -85,7 +82,7 @@ TEST_CASE("HDF5", "[utils]")
...
@@ -85,7 +82,7 @@ TEST_CASE("HDF5", "[utils]")
REQUIRE_THROWS_WITH
(
HDF5
::
readAttribute
<
double
>
(
file_id
,
"invalid attr"
),
REQUIRE_THROWS_WITH
(
HDF5
::
readAttribute
<
double
>
(
file_id
,
"invalid attr"
),
"error: cannot find attribute 'invalid attr'"
);
"error: cannot find attribute 'invalid attr'"
);
REQUIRE_THROWS_WITH
(
HDF5
::
readAttribute
<
double
>
(
file_id
,
"int64_t attr"
),
REQUIRE_THROWS_WITH
(
HDF5
::
readAttribute
<
double
>
(
file_id
,
"int64_t attr"
),
"error:
cannot find
attribute 'in
valid
attr'"
);
"error:
invalid type for
attribute 'in
t64_t
attr'"
);
HDF5
::
close
(
file_id
);
HDF5
::
close
(
file_id
);
}
}
...
...
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