From ffbfa4e55a3614696bad277a1a8dd4be193631db Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 21 Jun 2024 10:09:42 -0500 Subject: [PATCH] Fixed: fix documentation for createAndVerify #164 --- ving/docs/change-log.md | 1 + ving/record/VingRecord.mjs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ving/docs/change-log.md b/ving/docs/change-log.md index 46e79156..72abaa5b 100644 --- a/ving/docs/change-log.md +++ b/ving/docs/change-log.md @@ -11,6 +11,7 @@ outline: deep * NOTE: All your UI stuff will need to be updated to work with Tailwind and PrimeVue 4. * Added DarkModeSelector component. * Added ving-theme. +* Fixed: fix documentation for createAndVerify #164 ### 2024-06-06 * Fixed documentation for ving/utils/fs readJSON and writeJSON diff --git a/ving/record/VingRecord.mjs b/ving/record/VingRecord.mjs index 69e1de59..39dbc607 100644 --- a/ving/record/VingRecord.mjs +++ b/ving/record/VingRecord.mjs @@ -800,11 +800,14 @@ export class VingKind { * * @param {Object} props A list of props * @param {Object} currentUser A `User` or `Session` + * @throws 441 if no currentUser is passed * @returns {VingRecord} A newly minted record or throws an error if validation fails * @example - * const record = await Users.createAndVerify({username: 'andy'}) + * const record = await Users.createAndVerify({username: 'andy'}, currentUser) */ async createAndVerify(props, currentUser) { + if (isUndefined(currentUser)) + throw ving.ouch(441, `createAndVerify requires a user or session to test privileges against`); const obj = this.mint({}); obj.testCreationProps(props); await obj.setPostedProps(props, currentUser);