p-try
If the function throws an error, the returned Promise will be rejected with that error.
Official Documentation ↗v3.0.0. Check the official docs for the latest API surface.Installation
npm install p-trypnpm add p-tryMethods
No methods match this filter.
Overview
If the function throws an error, the returned Promise will be rejected with that error. Support for passing arguments on to the fn is provided in order to be able to avoid creating unnecessary closures.
API reference status
This page lists only entry points that appear verbatim in the official README examples: pTry, error. Parameter and return types are not given by the official README, so signatures are marked unverified.
Verification notes
- Official source: https://github.com/sindresorhus/p-try
- Evidence: https://cdn.jsdelivr.net/gh/sindresorhus/p-try@latest/readme.md
- Checked on 2026-11-04 by
scripts/phase11/build-api-profiles.mjs
API reference evidence
Fetched from official sources on 2026-11-08T18:21:00+08:00 via WebFetch https://cdn.jsdelivr.net/gh/sindresorhus/p-try@latest/readme.md(raw.githubusercontent.com 分支抓取返回空后改用官方 README 镜像).
pTry→ signature from https://cdn.jsdelivr.net/gh/sindresorhus/p-try@latest/readme.md; official text: “### pTry(fn, …arguments)”
FAQ
- What does p-try do?
- If the function throws an error, the returned Promise will be rejected with that error.
- How do I install p-try?
- Run `npm install p-try`.
- Where can I verify the API details?
- Official repository/documentation: https://github.com/sindresorhus/p-try. Checked on 2026-11-04; signatures and return values not stated in the official README are marked unverified.
Report a problem with this API docOpens a pre-filled issue on GitHub.