Project

General

Profile

« Previous | Next » 

Revision e09119d8

Added by Leszek Koltunski over 2 years ago

Report JSON errors also from the bandaged screen.

View differences:

src/main/java/org/distorted/bandaged/BandagedPlayLibInterface.java
27 27
import org.distorted.objectlib.BuildConfig;
28 28
import org.distorted.objectlib.helpers.BlockController;
29 29
import org.distorted.objectlib.helpers.ObjectLibInterface;
30
import org.distorted.objects.RubikObject;
31
import org.distorted.objects.RubikObjectList;
30 32

  
31 33
///////////////////////////////////////////////////////////////////////////////////////////////////
32 34

  
......
50 52
  public void onObjectCreated(long time) { }
51 53
  public void onReplaceModeDown(int cubit, int face) { }
52 54
  public void onReplaceModeUp() { }
53
  public void reportJSONError(String error, int ordinal) { }
54 55

  
55 56
///////////////////////////////////////////////////////////////////////////////////////////////////
56 57

  
......
174 175
      case BlockController.TYPE_THREAD: reportThreadProblem(place,pause,resume,time); break;
175 176
      }
176 177
    }
178

  
179
///////////////////////////////////////////////////////////////////////////////////////////////////
180

  
181
  public void reportJSONError(String error, int ordinal)
182
    {
183
    RubikObject object = RubikObjectList.getObject(ordinal);
184
    String name = object==null ? "NULL" : object.getUpperName();
185

  
186
    if( BuildConfig.DEBUG )
187
       {
188
       android.util.Log.e("libInterface", "name="+name+" JSON error: "+error);
189
       }
190
    else
191
      {
192
      Exception ex = new Exception(error);
193
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
194
      crashlytics.setCustomKey("name" , name );
195
      crashlytics.setCustomKey("JSONerror", error );
196
      crashlytics.recordException(ex);
197
      }
198
    }
199

  
177 200
}

Also available in: Unified diff