This commit is contained in:
seb
2026-10-08 12:44:53 +02:00
parent 79a1b72292
commit e2e7f8d566
11 changed files with 172 additions and 21 deletions

View File

@@ -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) {

View File

@@ -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;
}
};