@@ -16,11 +16,11 @@ func HandleGetApplication(c *gin.Context) {
16
16
17
17
if err != nil {
18
18
log .ErrorLogger ("Unable to get application data" , err )
19
-
20
19
errCode := helper .ExtractErrorCode (err )
20
+ errStr := helper .ExtractErrorString (err )
21
21
c .JSON (errCode , gin.H {
22
- "error" : strings . Split ( err . Error (), " " )[ 1 ] ,
23
- "message" : "Unable to get application data" ,
22
+ "error" : http . StatusText ( errCode ) ,
23
+ "message" : "Unable to get application data: " + errStr ,
24
24
})
25
25
return
26
26
}
@@ -36,11 +36,11 @@ func HandlePostApplication(c *gin.Context) {
36
36
err := c .BindJSON (& body )
37
37
38
38
if err != nil {
39
- log .ErrorLogger ("Unable to process json body" , err )
40
-
41
39
errCode := helper .ExtractErrorCode (err )
40
+
41
+ log .ErrorLogger ("Couldn't create application." , err )
42
42
c .JSON (errCode , gin.H {
43
- "error" : strings . Split ( err . Error (), " " )[ 1 ] ,
43
+ "error" : http . StatusText ( errCode ) ,
44
44
"message" : "Unable to process json body" ,
45
45
})
46
46
return
@@ -52,9 +52,10 @@ func HandlePostApplication(c *gin.Context) {
52
52
log .ErrorLogger ("Create application failed" , err )
53
53
54
54
errCode := helper .ExtractErrorCode (err )
55
+ errStr := helper .ExtractErrorString (err )
55
56
c .JSON (errCode , gin.H {
56
- "error" : strings . Split ( err . Error (), " " )[ 1 ] ,
57
- "message" : "Create application failed" ,
57
+ "error" : http . StatusText ( errCode ) ,
58
+ "message" : "Create application failed: " + errStr ,
58
59
})
59
60
return
60
61
}
@@ -74,7 +75,7 @@ func HandlePutApplication(c *gin.Context) {
74
75
75
76
errCode := helper .ExtractErrorCode (err )
76
77
c .JSON (errCode , gin.H {
77
- "error" : strings . Split ( err . Error (), " " )[ 1 ] ,
78
+ "error" : http . StatusText ( errCode ) ,
78
79
"message" : "Unable to process json body" ,
79
80
})
80
81
return
@@ -86,9 +87,10 @@ func HandlePutApplication(c *gin.Context) {
86
87
log .ErrorLogger ("Update application failed" , err )
87
88
88
89
errCode := helper .ExtractErrorCode (err )
90
+ errStr := helper .ExtractErrorString (err )
89
91
c .JSON (errCode , gin.H {
90
- "error" : strings . Split ( err . Error (), " " )[ 1 ] ,
91
- "message" : "Update application failed" ,
92
+ "error" : http . StatusText ( errCode ) ,
93
+ "message" : "Update application failed: " + errStr ,
92
94
})
93
95
return
94
96
}
@@ -108,7 +110,7 @@ func HandleDeleteApplication(c *gin.Context) {
108
110
109
111
errCode := helper .ExtractErrorCode (err )
110
112
c .JSON (errCode , gin.H {
111
- "error" : strings . Split ( err . Error (), " " )[ 1 ] ,
113
+ "error" : http . StatusText ( errCode ) ,
112
114
"message" : "Unable to process json body" ,
113
115
})
114
116
return
@@ -120,15 +122,16 @@ func HandleDeleteApplication(c *gin.Context) {
120
122
log .ErrorLogger ("Delete application failed" , err )
121
123
122
124
errCode := helper .ExtractErrorCode (err )
125
+ errStr := helper .ExtractErrorString (err )
123
126
c .JSON (errCode , gin.H {
124
- "error" : strings . Split ( err . Error (), " " )[ 1 ] ,
125
- "message" : "Delete application failed" ,
127
+ "error" : http . StatusText ( errCode ) ,
128
+ "message" : "Delete application failed: " + errStr ,
126
129
})
127
130
return
128
131
}
129
132
130
133
c .JSON (http .StatusOK , gin.H {
131
- "status " : "application deleted" ,
134
+ "message " : "application deleted" ,
132
135
})
133
136
134
137
}
@@ -162,7 +165,7 @@ func HandleUpdateClientSecret(c *gin.Context) {
162
165
}
163
166
164
167
c .JSON (http .StatusOK , gin.H {
165
- "status " : "Client Secret updated successfully" ,
168
+ "message " : "Client Secret updated successfully" ,
166
169
})
167
170
168
171
}
0 commit comments