//
// This file is auto-generated. Please don't modify it!
//

#include "common.h"
$includes
using namespace std;

#undef LOG_TAG
#define LOG_TAG "org.visp.$m"

/// throw java exception
#undef throwJavaException
#define throwJavaException throwJavaException_$m
static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method) {
  std::string what = "unknown exception";
  jclass je = 0;

  if(e) {
    std::string exception_type = "std::exception";

    if(dynamic_cast<const vpException*>(e)) {
      exception_type = "vpException";
      je = env->FindClass("org/visp/core/VpException");
    }

    what = exception_type + ": " + e->what();
  }

  if(!je) je = env->FindClass("java/lang/Exception");
  env->ThrowNew(je, what.c_str());

  LOGE("%s caught %s", method, what.c_str());
  (void)method;        // avoid "unused" warning
}

extern "C" {

$code

} // extern "C"
