Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DP3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
DP3
Commits
07ab90b5
Commit
07ab90b5
authored
2 years ago
by
Maik Nijhuis
Browse files
Options
Downloads
Patches
Plain Diff
Catch HDF5 exceptions in DP3 main
parent
995f113e
No related branches found
No related tags found
1 merge request
!1033
Catch HDF5 exceptions in DP3 main
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+11
-4
11 additions, 4 deletions
CMakeLists.txt
base/Main.cc
+16
-6
16 additions, 6 deletions
base/Main.cc
with
27 additions
and
10 deletions
CMakeLists.txt
+
11
−
4
View file @
07ab90b5
...
@@ -130,13 +130,11 @@ if(ENABLE_EXPERIMENTAL_SCREENFITTER)
...
@@ -130,13 +130,11 @@ if(ENABLE_EXPERIMENTAL_SCREENFITTER)
endif
()
endif
()
endif
()
endif
()
#
Casacore depends on HDF5 -> Firs
t load HDF5.
#
Load HDF5 before Casacore, since some Casacore versions do no
t load HDF5.
find_package
(
find_package
(
HDF5
HDF5
COMPONENTS C CXX
COMPONENTS C CXX
REQUIRED
)
REQUIRED
)
add_definitions
(
${
HDF5_DEFINITIONS
}
)
include_directories
(
${
HDF5_INCLUDE_DIRS
}
)
find_package
(
find_package
(
Casacore
Casacore
...
@@ -144,6 +142,15 @@ find_package(
...
@@ -144,6 +142,15 @@ find_package(
REQUIRED
)
REQUIRED
)
include_directories
(
SYSTEM
${
CASACORE_INCLUDE_DIR
}
)
include_directories
(
SYSTEM
${
CASACORE_INCLUDE_DIR
}
)
# Reload HDF5, since some Casacore versions also load HDF5, but without C++
# support. ${HDF5_LIBRARIES} then does not include C++ libraries.
find_package
(
HDF5
COMPONENTS C CXX
REQUIRED
)
add_definitions
(
${
HDF5_DEFINITIONS
}
)
include_directories
(
${
HDF5_INCLUDE_DIRS
}
)
find_package
(
CFITSIO REQUIRED
)
find_package
(
CFITSIO REQUIRED
)
include_directories
(
${
CFITSIO_INCLUDE_DIRS
}
)
include_directories
(
${
CFITSIO_INCLUDE_DIRS
}
)
...
@@ -562,7 +569,7 @@ set(SOURCEDB_LIBRARIES Blob Common ParmDB ${CASACORE_LIBRARIES}
...
@@ -562,7 +569,7 @@ set(SOURCEDB_LIBRARIES Blob Common ParmDB ${CASACORE_LIBRARIES}
${
Boost_SYSTEM_LIBRARY
}
)
${
Boost_SYSTEM_LIBRARY
}
)
add_executable
(
DP3 base/Main.cc
)
add_executable
(
DP3 base/Main.cc
)
target_link_libraries
(
DP3 LIBDP3
)
target_link_libraries
(
DP3 LIBDP3
${
HDF5_LIBRARIES
}
)
add_executable
(
makesourcedb parmdb/makesourcedb.cc
)
add_executable
(
makesourcedb parmdb/makesourcedb.cc
)
target_link_libraries
(
makesourcedb
${
SOURCEDB_LIBRARIES
}
)
target_link_libraries
(
makesourcedb
${
SOURCEDB_LIBRARIES
}
)
...
...
This diff is collapsed.
Click to expand it.
base/Main.cc
+
16
−
6
View file @
07ab90b5
...
@@ -4,15 +4,17 @@
...
@@ -4,15 +4,17 @@
//
//
// @author Ger van Diepen
// @author Ger van Diepen
#include
<dp3/base/DP3.h>
#include
<filesystem>
#include
<iostream>
#include
<stdexcept>
#include
<
Version
.h>
#include
<
H5Cpp
.h>
#include
<aocommon/checkblas.h>
#include
<aocommon/checkblas.h>
#include
<
filesystem
>
#include
<
dp3/base/DP3.h
>
#include
<iostream>
#include
<
stdexcept
>
#include
<
Version.h
>
// Define handler that tries to print a backtrace.
// Define handler that tries to print a backtrace.
// Exception::TerminateHandler t(Exception::terminate);
// Exception::TerminateHandler t(Exception::terminate);
...
@@ -70,9 +72,17 @@ int main(int argc, char* argv[]) {
...
@@ -70,9 +72,17 @@ int main(int argc, char* argv[]) {
// Execute the parset file.
// Execute the parset file.
dp3
::
base
::
Execute
(
parsetName
,
argc
,
argv
);
dp3
::
base
::
Execute
(
parsetName
,
argc
,
argv
);
}
catch
(
std
::
exception
&
err
)
{
}
catch
(
const
std
::
exception
&
err
)
{
std
::
cerr
<<
"
\n
std exception detected: "
<<
err
.
what
()
<<
'\n'
;
std
::
cerr
<<
"
\n
std exception detected: "
<<
err
.
what
()
<<
'\n'
;
return
1
;
return
1
;
}
catch
(
const
H5
::
Exception
&
err
)
{
// Since H5::Exception is not derived from std::exception, DP3 crashes
// if it does not catch them -> Print an error message instead.
std
::
cerr
<<
"
\n
H5 exception detected: "
<<
err
.
getDetailMsg
()
<<
"
\n
Stack trace:
\n
"
;
err
.
printErrorStack
();
std
::
cerr
<<
'\n'
;
return
1
;
}
}
return
0
;
return
0
;
}
}
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