Project

General

Profile

« Previous | Next » 

Revision c020555e

Added by Leszek Koltunski almost 2 years ago

Do not crash when something's wrong with the JSON file - handle this gracefully, do not change the object then, and report this to Firebase.

View differences:

src/main/java/org/distorted/main/RubikObjectLibInterface.java
436 436
      }
437 437
    }
438 438

  
439
///////////////////////////////////////////////////////////////////////////////////////////////////
440

  
441
  public void reportJSONError(String error, int ordinal)
442
    {
443
    RubikObject object = RubikObjectList.getObject(ordinal);
444
    String name = object==null ? "NULL" : object.getUpperName();
445

  
446
    if( BuildConfig.DEBUG )
447
       {
448
       android.util.Log.e("libInterface", "name="+name+" JSON error: "+error);
449
       }
450
    else
451
      {
452
      Exception ex = new Exception(error);
453
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
454
      crashlytics.setCustomKey("name" , name );
455
      crashlytics.setCustomKey("JSONerror", error );
456
      crashlytics.recordException(ex);
457
      }
458
    }
459

  
439 460
///////////////////////////////////////////////////////////////////////////////////////////////////
440 461

  
441 462
  public void onReplaceModeDown(int cubit, int face)

Also available in: Unified diff