mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-25 19:55:26 +03:00
17 lines
359 B
JavaScript
17 lines
359 B
JavaScript
import * as Logging from "~/common/logging";
|
|
|
|
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;
|
|
};
|