mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-01 14:43:54 +03:00
17 lines
381 B
JavaScript
17 lines
381 B
JavaScript
import * as NodeLogging from "~/node_common/node-logging";
|
|
|
|
import DB from "~/node_common/database";
|
|
|
|
export const runQuery = async ({ queryFn, errorFn, label }) => {
|
|
let response;
|
|
try {
|
|
response = await queryFn(DB);
|
|
} catch (e) {
|
|
NodeLogging.error(`DB:${label}: ${e.message}`);
|
|
response = errorFn(e);
|
|
}
|
|
|
|
NodeLogging.log(`DB:${label}`);
|
|
return response;
|
|
};
|