u
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { getStore } from './store.js';
|
||||
|
||||
export async function createUnderParent({ googleAuthId, parentId, name, track_stock, sku }) {
|
||||
export async function createUnderParent(args) {
|
||||
const store = await getStore();
|
||||
return store.article.createUnderParent({ googleAuthId, parentId, name, track_stock, sku });
|
||||
return store.article.createUnderParent(args);
|
||||
}
|
||||
|
||||
export async function getBySku(googleAuthId, sku) {
|
||||
|
||||
@@ -70,10 +70,17 @@ function wrapStoreWithTiming(rawStore) {
|
||||
storeLog.debug(`${namespace}.${method} ${chalk.gray(`(${Date.now() - start}ms)`)}`);
|
||||
return result;
|
||||
} catch (err) {
|
||||
storeLog.error(
|
||||
`${namespace}.${method} ${chalk.red('FAILED')} ` +
|
||||
`${chalk.gray(`(${Date.now() - start}ms)`)} ${chalk.red(err.message)}`
|
||||
);
|
||||
const isNotFound = /not found/i.test(err?.message);
|
||||
if (isNotFound) {
|
||||
storeLog.debug(
|
||||
`${namespace}.${method} ${chalk.gray(`(${Date.now() - start}ms)`)} ${chalk.gray(err.message)}`
|
||||
);
|
||||
} else {
|
||||
storeLog.error(
|
||||
`${namespace}.${method} ${chalk.red('FAILED')} ` +
|
||||
`${chalk.gray(`(${Date.now() - start}ms)`)} ${chalk.red(err.message)}`
|
||||
);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user