PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
e_report.c
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: e_report.c
3 
4 Function's developer:
5 Copyright (c) 2016 Celia Virginia Vergara Castillo
6 Mail: vicky_vergara@hotmail.com
7 
8 ------
9 
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 
24  ********************************************************************PGR-GNU*/
25 
26 #include "./postgres_connection.h"
27 #include "./debug_macro.h"
28 #include "./e_report.h"
29 
30 void
32  char* notice) {
33  PGR_DBG("Returned notice message = %s", notice);
34 
35  if (notice) {
36  ereport(NOTICE,
37  (errmsg("%s", notice)));
38  }
39 }
40 
41 void
43  char* log,
44  char* notice) {
45  PGR_DBG("Returned log message = %s", log);
46  PGR_DBG("Returned notice message = %s", notice);
47 
48  if (log) {
49  pgr_notice(notice);
50  return;
51  }
52 
53  if (notice) {
54  ereport(NOTICE,
55  (errmsg("%s", notice),
56  errhint("%s", log)));
57  }
58 }
59 
60 void
61 pgr_error(char* err) {
62  PGR_DBG("Returned error message = %s", err);
63 
64 #if 0
65  char *error = NULL;
66  if (*err_msg) {
67  error = pgr_cstring2char(*err_msg);
68  free(*err_msg);
69  }
70 #endif
71  if (err) {
72  ereport(ERROR,
73  (errmsg_internal("Unexpected"),
74  errhint("%s", err)));
75  }
76 }
77 
78 void
80  char* log,
81  char* err) {
82  PGR_DBG("Returned log message = %s", log);
83  PGR_DBG("Returned error message = %s", err);
84 
85  if (err) {
86  ereport(ERROR,
87  (errmsg_internal("%s", err),
88  errhint("%s", log)));
89  }
90 }
91 
92 void
94  char* log,
95  char* notice,
96  char* err) {
97  if (!notice && log) {
98  ereport(DEBUG1,
99  (errmsg_internal("%s", log)));
100  }
101 
102  if (notice) {
103  if (log) {
104  ereport(NOTICE,
105  (errmsg_internal("%s", notice),
106  errhint("%s", log)));
107  } else {
108  ereport(NOTICE,
109  (errmsg_internal("%s", notice)));
110  }
111  }
112 
113  if (err) {
114  if (log) {
115  ereport(ERROR,
116  (errmsg_internal("%s", err),
117  errhint("%s", log)));
118  } else {
119  ereport(ERROR,
120  (errmsg_internal("%s", err)));
121  }
122  }
123 }
#define PGR_DBG(...)
Definition: debug_macro.h:34
void pgr_notice(char *notice)
notice with no hint
Definition: e_report.c:31
void pgr_error(char *err)
error with no hint
Definition: e_report.c:61
void pgr_global_report(char *log, char *notice, char *err)
notice & error
Definition: e_report.c:93
char * pgr_cstring2char(const char *inStr)
void pgr_notice2(char *log, char *notice)
notice with hint
Definition: e_report.c:42
char * err_msg
Definition: BDATester.cpp:50
void pgr_error2(char *log, char *err)
error with hint
Definition: e_report.c:79