@@ -62,15 +62,20 @@ public ApiService(string apiUrl)
62
62
public InfoModel Info ( )
63
63
{
64
64
var infoModel = new InfoModel ( ) ;
65
+
66
+ // Building request model
65
67
var requestModel = _requestModelHelper . InfoProperties ( ApiUrl , "info" ) ;
66
68
67
69
try
68
70
{
71
+ // Making Api request and gathering response
69
72
var webResponse = _api . MakeGetRequest ( requestModel ) ;
70
73
var webResult = _webResponseHelper . GetResponsePayload ( webResponse ) ;
71
74
72
- // ** TO DO - Check for error before converting to model. Expand model to include error properties?
75
+ // Trying to bind result to model
73
76
infoModel = JsonConvert . DeserializeObject < InfoModel > ( webResult , JsonSerializerSettings ) ;
77
+ infoModel . Headers . statusCode = _webResponseHelper . GetStatusCode ( webResponse ) ;
78
+ infoModel . Headers . statusDescription = _webResponseHelper . GetStatusDescription ( webResponse ) ;
74
79
75
80
if ( infoModel . engineVersion != null )
76
81
{
@@ -83,6 +88,9 @@ public InfoModel Info()
83
88
infoModel . Errors . Add ( new Error { message = ex . ToString ( ) } ) ;
84
89
}
85
90
91
+ // Checking if errors have occoured either from ethier api or wrapper
92
+ if ( infoModel . Errors . Count != 0 && ! infoModel . HasErrorOccurred ) { infoModel . HasErrorOccurred = true ; }
93
+
86
94
return infoModel ;
87
95
}
88
96
@@ -125,6 +133,9 @@ public AnalyzeModel Analyze(string host, Publish publish, ClearCache clearCache,
125
133
analyzeModel . Errors . Add ( new Error { message = ex . ToString ( ) } ) ;
126
134
}
127
135
136
+ // Checking if errors have occoured either from ethier api or wrapper
137
+ if ( analyzeModel . Errors . Count != 0 && ! analyzeModel . HasErrorOccurred ) { analyzeModel . HasErrorOccurred = true ; }
138
+
128
139
return analyzeModel ;
129
140
}
130
141
0 commit comments