@syngrisi/syngrisi
Version:
Syngrisi - Visual Testing Tool
20 lines (18 loc) • 524 B
JavaScript
// src/server/utils/paramsGuard.ts
var paramsGuard = (params, functionName, schema) => {
const result = schema.safeParse(params);
if (result.success) {
return true;
} else {
const errorDetails = result.error.format();
throw new Error(`
Invalid '${functionName}' parameters: ${JSON.stringify(errorDetails)}
error: ${result.error.stack || result.error}
params: ${JSON.stringify(params, null, 2)}
`);
}
};
export {
paramsGuard
};
//# sourceMappingURL=paramsGuard.js.map