FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
idefix/src/error.cpp at master · idefix-code/idefix · GitHub
idefix-code
idefix
Repository navigation
Code
Issues
3
(3)
Pull requests
9
(9)
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
idefix
/
src
/
error.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
110 lines (105 loc) · 4.67 KB
Breadcrumbs
idefix
/
src
/
error.cpp
Copy path
File metadata and controls
110 lines (105 loc) · 4.67 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//
***********************************************************************************
//
Idefix MHD astrophysical code
//
//
Source file src/error.cpp
//
//
Last modified : 10/2023
//
//
Copyright(C) by :
//
- Geoffroy Lesur <geoffroy.lesur@univ-grenoble-alpes.fr> (IPAG/UGA/CNRS - 2020 - 2023)
//
and other code contributors
//
//
Licensed under CeCILL 2.1 License, see COPYING for more information
//
***********************************************************************************
#
include
<
cstdio
>
#
include
<
string
>
#
include
"
idefix.hpp
"
#
include
"
error.hpp
"
void
ErrorHandler
(
const
int
ErrorType,
std::stringstream &ErrorMessage,
std::string ErrorFunction,
const
int
ErrorLine,
std::string ErrorFile) {
if
(ErrorType ==
ERROR_WARNING
) {
idfx::cerr << std::endl
<<
"
------------------------------------------------------------------------------
"
<< std::endl;
idfx::cerr <<
"
## WARNING in function
"
<< ErrorFunction <<
"
file
"
<< ErrorFile <<
"
line
"
<< ErrorLine << std::endl;
idfx::cerr << ErrorMessage.
str
() << std::endl;
idfx::cerr <<
"
------------------------------------------------------------------------------
"
<< std::endl;
if
(idfx::warningsAreErrors) {
idfx::cerr <<
"
Warnings are considered as errors
"
<< std::endl;
idfx::safeExit
(
1
);
}
}
else
if
(ErrorType ==
ERROR_DEPRECATED
) {
idfx::cerr << std::endl
<<
"
------------------------------------------------------------------------------
"
<< std::endl;
idfx::cerr <<
"
## DEPRECATED call in function
"
<< ErrorFunction <<
"
file
"
<< ErrorFile
<< std::endl
<<
"
## This function will be removed in the next Idefix release.
"
<< std::endl;
idfx::cerr << ErrorMessage.
str
() << std::endl;
idfx::cerr <<
"
------------------------------------------------------------------------------
"
<< std::endl;
if
(idfx::warningsAreErrors) {
idfx::cerr <<
"
Warnings are considered as errors
"
<< std::endl;
idfx::safeExit
(
1
);
}
}
else
{
idfx::cerr << std::endl
<<
"
------------------------------------------------------------------------------
"
<< std::endl;
idfx::cerr <<
"
### FATAL ERROR in function
"
<< ErrorFunction <<
"
file
"
<< ErrorFile
<<
"
line
"
<< ErrorLine << std::endl;
idfx::cerr << ErrorMessage.
str
() << std::endl;
idfx::cerr <<
"
------------------------------------------------------------------------------
"
<< std::endl;
idfx::safeExit
(
1
);
}
}
void
ErrorHandler
(
const
int
ErrorType,
std::string ErrorMessage,
std::string ErrorFunction,
const
int
ErrorLine,
std::string ErrorFile) {
if
(ErrorType ==
ERROR_WARNING
) {
idfx::cerr << std::endl
<<
"
------------------------------------------------------------------------------
"
<< std::endl;
idfx::cerr <<
"
## WARNING in function
"
<< ErrorFunction <<
"
file
"
<< ErrorFile <<
"
line
"
<< ErrorLine << std::endl;
idfx::cerr << ErrorMessage << std::endl;
idfx::cerr <<
"
------------------------------------------------------------------------------
"
<< std::endl;
if
(idfx::warningsAreErrors) {
idfx::cerr <<
"
Warnings are considered as errors
"
<< std::endl;
idfx::safeExit
(
1
);
}
}
else
if
(ErrorType ==
ERROR_DEPRECATED
) {
idfx::cerr << std::endl
<<
"
------------------------------------------------------------------------------
"
<< std::endl;
idfx::cerr <<
"
## DEPRECATED call in function
"
<< ErrorFunction <<
"
file
"
<< ErrorFile
<< std::endl
<<
"
## This function will be removed in the next Idefix release.
"
<< std::endl;
idfx::cerr << ErrorMessage << std::endl;
idfx::cerr <<
"
------------------------------------------------------------------------------
"
<< std::endl;
if
(idfx::warningsAreErrors) {
idfx::cerr <<
"
Warnings are considered as errors
"
<< std::endl;
idfx::safeExit
(
1
);
}
}
else
{
idfx::cerr << std::endl
<<
"
------------------------------------------------------------------------------
"
<< std::endl;
idfx::cerr <<
"
### FATAL ERROR in function
"
<< ErrorFunction <<
"
file
"
<< ErrorFile
<<
"
line
"
<< ErrorLine << std::endl;
idfx::cerr << ErrorMessage << std::endl;
idfx::cerr <<
"
------------------------------------------------------------------------------
"
<< std::endl;
idfx::safeExit
(
1
);
}
}
Back
|
FazBrowse Home
|
New Git URL