package com.ctpodp;

import android.util.Log;

import androidx.annotation.NonNull;

class MapCanvasCrashHandler implements Thread.UncaughtExceptionHandler {
  @Override
  public void uncaughtException(@NonNull Thread thread, @NonNull Throwable throwable) {
    String mapCanvasException = "Attempt to invoke virtual method 'void android.graphics.Canvas.drawColor(int, android.graphics.PorterDuff$Mode)' on a null object reference";
    if (!throwable.getMessage().equals(mapCanvasException)) {
      throw new RuntimeException(throwable);
    }
    else {
      Log.w("ERROR_CAUGHT", "mapCanvasException caught in CrashHandler: " +  throwable.getMessage());
    }
  }
}
