slate/node_common/data/utilities.js

17 lines
359 B
JavaScript
Raw Normal View History

import * as Logging from "~/common/logging";
2020-11-25 12:47:29 +03:00
import DB from "~/node_common/database";
export const runQuery = async ({ queryFn, errorFn, label }) => {
let response;
try {
response = await queryFn(DB);
} catch (e) {
Logging.error(`DB:${label}: ${e.message}`);
response = errorFn(e);
}
Logging.log(`DB:${label}`);
return response;
};