docs(function): return results directly in managing-idp-users samples#156
Merged
Conversation
The `tailor.idp` client methods reject on failure, so wrapping their
results in a `{ success }` object made the samples read as if they
presuppose try/catch-based error handling — and implicitly recommended
returning a result object. Return the meaningful value directly and let
errors propagate as thrown exceptions, so the samples reflect the
recommended "throw unless you need to control the error or its message"
style rather than a success/error result object.
…d factors Apply Copilot review feedback on the managing-idp-users samples. - Drop the redundant `await` from the `deleteUser`, `sendPasswordResetEmail`, and single-factor `unenrollMfa` samples. With no surrounding `try`/`catch`, returning the promise directly is equivalent and reads more simply. - In the reset-all-MFA sample, filter `user.mfaFactorIds` by the boolean results of `unenrollMfa()` so `unenrolledFactorIds` reflects the factors that were actually unenrolled, rather than assuming every factor succeeded.
k1LoW
marked this pull request as ready for review
July 2, 2026 04:46
anukiransolur
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Managing Built-in IdP Usersguide showed samples that wrapped method results in a{ success: ... }(or{ success: true }) object. Because thetailor.idpclient methods reject on failure, that wrapping reads as if the samples presuppose try/catch-based error handling, and it implicitly recommends returning a success/error result object. This updates every sample in the guide to return the meaningful value directly and let errors propagate as thrown exceptions — matching the recommended "throw unless you need to control the error or its message" style.Changes
docs/guides/function/managing-idp-users.md— remove the{ success }result-object framing from every sample:success: truefield; return only the meaningful record data (userId,userName,disabled, …).{ success }.{ success: false, reason }guard and theresults.every(Boolean)aggregation; return the list of unenrolled factor IDs ({ unenrolledFactorIds }) and let any failure throw.No prose sections were added or removed; only the sample code returns changed.
Verification
pnpm build✅ (guide renders)pnpm lint✅ (no new issues)