File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
app/src/main/java/tk/therealsuji/vtopchennai Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 1414
1515import com .google .android .material .color .MaterialColors ;
1616import com .google .firebase .analytics .FirebaseAnalytics ;
17+ import com .google .firebase .crashlytics .FirebaseCrashlytics ;
1718
1819import org .json .JSONArray ;
1920import org .json .JSONObject ;
@@ -347,9 +348,13 @@ private void setLoading(boolean isLoading) {
347348 }
348349
349350 private void throwErrorIfExists (JSONObject jsonObject ) throws Exception {
351+ FirebaseCrashlytics crashlytics = FirebaseCrashlytics .getInstance ();
352+
350353 if (jsonObject .has ("error" )) {
354+ crashlytics .log ("Moodle error. " + jsonObject .getString ("error" ));
351355 throw new Exception (jsonObject .getString ("error" ));
352356 } else if (jsonObject .has ("message" )) {
357+ crashlytics .log ("Moodle error. " + jsonObject .getString ("message" ));
353358 throw new Exception (jsonObject .getString ("message" ));
354359 }
355360 }
Original file line number Diff line number Diff line change @@ -266,13 +266,12 @@ private void updateProgress(Integer currentDownload) {
266266 * Function to handle errors.
267267 */
268268 private void error (final int errorCode , final String errorMessage ) {
269- String error = "Error " + errorCode + ". " + errorMessage ;
270- Toast .makeText (getApplicationContext (), error , Toast .LENGTH_SHORT ).show ();
269+ Toast .makeText (getApplicationContext (), "Error " + errorCode + ". " + errorMessage , Toast .LENGTH_SHORT ).show ();
271270 this .reloadPage ();
272271
273272 // Firebase Crashlytics Logging
274273 FirebaseCrashlytics crashlytics = FirebaseCrashlytics .getInstance ();
275- crashlytics .log (error );
274+ crashlytics .log ("VTOP error " + errorCode + ". " + errorMessage );
276275 }
277276
278277 /**
You can’t perform that action at this time.
0 commit comments