diff --git a/iModelJsNodeAddon/IModelJsNative.h b/iModelJsNodeAddon/IModelJsNative.h index 8ae2d27e1c..571a4a9b6a 100644 --- a/iModelJsNodeAddon/IModelJsNative.h +++ b/iModelJsNodeAddon/IModelJsNative.h @@ -360,7 +360,7 @@ ENUM_IS_FLAGS(TextEmphasis); struct JsInterop { [[noreturn]] static void throwSqlResult(Utf8CP msg, Utf8CP fileName, DbResult result) { - BeNapi::ThrowJsException(Env(), Utf8PrintfString("%s [%s]: %s", msg, fileName, BeSQLiteLib::GetErrorString(result)).c_str(), result); + BeNapi::ThrowJsException(Env(), Utf8PrintfString("%s [%s]: rc=%d, %s", msg, fileName, (int)result, BeSQLiteLib::GetLogError(result).c_str()).c_str(), result); } [[noreturn]] static void throwDgnDbStatus(DgnDbStatus); [[noreturn]] static void throwWrongClass() { throwDgnDbStatus(DgnDbStatus::WrongClass); } diff --git a/iModelJsNodeAddon/JsInteropDgnDb.cpp b/iModelJsNodeAddon/JsInteropDgnDb.cpp index 8e37a1d717..64889a9866 100644 --- a/iModelJsNodeAddon/JsInteropDgnDb.cpp +++ b/iModelJsNodeAddon/JsInteropDgnDb.cpp @@ -871,7 +871,7 @@ Napi::String JsInterop::InsertLinkTableRelationship(DgnDbR dgndb, Napi::Object o BeSQLite::EC::ECInstanceKey relKey; auto rc = dgndb.InsertLinkTableRelationship(relKey, *relClass, sourceId, targetId, props.get()); // nullptr is okay if there are no props if (BE_SQLITE_OK != rc) - throwSqlError(); + JsInterop::throwSqlResult("Failed to insert relationship", dgndb.GetDbFileName(), rc); return Napi::String::New(Env(), relKey.GetInstanceId().ToHexStr()); }