1 // Copyright 2013 The Flutter Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package io.flutter.plugin.common; 6 7 import android.util.Log; 8 9 import io.flutter.BuildConfig; 10 11 /** 12 * Thrown to indicate that a Flutter method invocation failed on the Flutter side. 13 */ 14 public class FlutterException extends RuntimeException { 15 private static final String TAG = "FlutterException#"; 16 17 public final String code; 18 public final Object details; 19 FlutterException(String code, String message, Object details)20 FlutterException(String code, String message, Object details) { 21 super(message); 22 if (BuildConfig.DEBUG && code == null) { 23 Log.e(TAG, "Parameter code must not be null."); 24 } 25 this.code = code; 26 this.details = details; 27 } 28 } 29