Skip to content

Commit 8312eb3

Browse files
committed
print edit errors
1 parent f105cba commit 8312eb3

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

app/src/main/cpp/core_wrapper.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,22 @@ Java_at_tomtasche_reader_background_CoreWrapper_backtranslateNative(JNIEnv *env,
269269
jfieldID outputPathField = env->GetFieldID(resultClass, "outputPath", "Ljava/lang/String;");
270270
env->SetObjectField(result, outputPathField, outputPath);
271271

272+
__android_log_print(ANDROID_LOG_DEBUG, "smn", "HTML diff: %s", htmlDiffC);
273+
272274
try {
273275
odr::html::edit(*s_document, htmlDiffC);
274276

275277
env->ReleaseStringUTFChars(htmlDiff, htmlDiffC);
278+
} catch (const std::exception &e) {
279+
env->ReleaseStringUTFChars(htmlDiff, htmlDiffC);
280+
281+
__android_log_print(ANDROID_LOG_ERROR, "smn", "Failed to edit document: %s", e.what());
282+
env->SetIntField(result, errorField, -6);
283+
return result;
276284
} catch (...) {
277285
env->ReleaseStringUTFChars(htmlDiff, htmlDiffC);
278286

287+
__android_log_print(ANDROID_LOG_ERROR, "smn", "Failed to edit document: unknown exception");
279288
env->SetIntField(result, errorField, -6);
280289
return result;
281290
}

0 commit comments

Comments
 (0)