Promise.try()Baseline · Newly available
The Promise.try() static method returns a promise that takes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result in a Promise.
Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Jan 7, 2025.
Browser support
DesktopChrome
1–127Not supported
128+Supportedsince Aug 20, 2024
Current: 155Edge
12–127Not supported
128+Supportedsince Aug 22, 2024
Current: 154Firefox
1–133Not supported
134+Supportedsince Jan 7, 2025
Current: 157Safari
1–18.1Not supported
18.2+Supportedsince Dec 11, 2024
Current: 27MobileChrome Android
18–127Not supported
128+Supportedsince Aug 20, 2024
Current: 155Firefox Android
4–133Not supported
134+Supportedsince Jan 7, 2025
Current: 157Safari iOS
1–18.1Not supported
18.2+Supportedsince Dec 11, 2024
Current: 27How to use
Every current browser supports this, but it only became Baseline on Jan 7, 2025. Use it as a progressive enhancement, or keep a fallback if you support older devices.
Example
Full syntax and examples are on MDN: try.
Feature detection
JS · check before using
if ("try" in Promise || ("prototype" in Promise && "try" in Promise.prototype)) {
// Promise.try is available
}