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
use HttpResponse;
use Serialize;
use json;
/// Constructs a standard success JSON response for dumbo series libraries.
///
/// # Arguments
/// * `data` - The data payload to be serialized in the response body
///
/// # Returns
/// `HttpResponse` with 200 OK status and JSON body containing:
/// - `data`: serialized input data
/// - `success`: boolean true indicating successful operation
/// Constructs a standard error JSON response for dumbo series libraries.
///
/// Logs the error internally before returning formatted response.
///
/// # Arguments
/// * `err_msg` - Human-readable error description
/// * `e` - Original error object for debugging (logged with Debug format)
/// * `error_code` - Optional numeric error code (defaults to 0 if None)
///
/// # Returns
/// `HttpResponse` with 500 Internal Server Error status and JSON body containing:
/// - `success`: boolean false indicating operation failure
/// - `error`: provided error message string
/// - `errorCode`: numeric error code