@@ -38,6 +38,38 @@ extern nr_error_t* nr_error_create(int priority,
38
38
const char * span_id ,
39
39
nrtime_t when );
40
40
41
+ /*
42
+ * Purpose : Create a new error for the use case where additional parameters are
43
+ * passed in.
44
+ *
45
+ * Params : 1. The importance of the error. Higher number is more important.
46
+ * 2. Message string.
47
+ * 3. Class string. This string is used to aggregate errors in RPM.
48
+ * RPM does not expect strings from a specific namespace.
49
+ * The PHP agent uses PHP's predefined error constant names.
50
+ * Examples are "E_ERROR" and "E_WARNING".
51
+ * 4. Error file provided by user.
52
+ * 5. Error line provided by user.
53
+ * 6. Error context provided by user.
54
+ * 7. Error number provided by user.
55
+ * 8. String containing stack trace in JSON format.
56
+ * 9. Span ID
57
+ * 10. When the error occurred.
58
+ *
59
+ * Returns : A newly allocated error, or 0 on failure.
60
+ */
61
+ extern nr_error_t * nr_error_create_additional_params (
62
+ int priority ,
63
+ const char * message ,
64
+ const char * klass ,
65
+ const char * error_file ,
66
+ int error_line ,
67
+ const char * error_context ,
68
+ int error_no ,
69
+ const char * stacktrace_json ,
70
+ const char * span_id ,
71
+ nrtime_t when );
72
+
41
73
/*
42
74
* Purpose : Retrieve error fields for the purpose of creating attributes.
43
75
*/
@@ -54,6 +86,43 @@ extern const char* nr_error_get_message(const nr_error_t* error);
54
86
* Returns : The klass of the error or NULL on failure.
55
87
*/
56
88
extern const char * nr_error_get_klass (const nr_error_t * error );
89
+
90
+ /*
91
+ * Purpose : Get the error file of an error.
92
+ *
93
+ * Returns : The error file of the error or NULL on failure.
94
+ */
95
+ extern const char * nr_error_get_file (const nr_error_t * error );
96
+
97
+ /*
98
+ * Purpose : Get the error line of an error.
99
+ *
100
+ * Returns : The error line of the error or 0 on failure.
101
+ */
102
+ extern int nr_error_get_line (const nr_error_t * error );
103
+
104
+ /*
105
+ * Purpose : Get the error context of an error.
106
+ *
107
+ * Returns : The error context of the error or NULL on failure.
108
+ */
109
+ extern const char * nr_error_get_context (const nr_error_t * error );
110
+
111
+ /*
112
+ * Purpose : Get the error number of an error.
113
+ *
114
+ * Returns : The error number of the error or 0 on failure.
115
+ */
116
+ extern int nr_error_get_no (const nr_error_t * error );
117
+
118
+ /*
119
+ * Purpose : Determine if the option is 0 or 1. If 1, then this means the error
120
+ * has additional arguments.
121
+ *
122
+ * Returns : Either 0 or 1
123
+ */
124
+ extern int nr_error_get_option (const nr_error_t * error );
125
+
57
126
/*
58
127
* Purpose : Get the span_id of an error.
59
128
*
@@ -80,6 +149,11 @@ extern int nr_error_priority(const nr_error_t* error);
80
149
*/
81
150
extern void nr_error_destroy (nr_error_t * * error_ptr );
82
151
152
+ /*
153
+ * Purpose : Destroys an error with extra parameters, freeing all of its associated memory.
154
+ */
155
+ extern void nr_error_destroy_additional_params (nr_error_t * * error_ptr );
156
+
83
157
/*
84
158
* Purpose : Turn an error into the JSON format expected by the 'error_v1'
85
159
* command. Returns NULL if an error occurs.
0 commit comments