Issue 1:
There was some recent confusion on my team about why https://github.com/electron/electron/releases/tag/v1.7.10 lists downloads for both arm and armv7l, when https://electronjs.org/docs/tutorial/supported-platforms only mentions the arm architecture.

After more confusion and a bit of searching I eventually found https://github.com/electron/electron/blob/master/docs/tutorial/planned-breaking-changes.md#duplicate-arm-assets which cleared up the confusion, but it would be great if that info (i.e. the fact that arm and armv7l are currently identical) was also added to https://electronjs.org/docs/tutorial/supported-platforms to stop anybody else getting similarly confused 😉

Issue 2:
Preflight Checklist

I have read the Contributing Guidelines for this project.

I agree to follow the Code of Conduct that this project adheres to.

I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

Electron Version:

v9.0.0

Operating System:

Windows 10 (1909)

Last Known Working Electron version:

Not sure

Expected Behavior

UnhandledPromiseRejectionWarning warnings should not be printed since all promise rejections are handled.

Similar script executed in plain Node.js project (not Electron) with recent Node version (v12.16.1) does not produce these warnings.

Actual Behavior

UnhandledPromiseRejectionWarning warnings are printed even though all promise rejections are handled.

To Reproduce

git clone https://github.com/ivanggq/electron-async-vs-promise-issue.git -b master
cd electron-async-vs-promise-issue/
npm install
npm start

Screenshots

Additional Information

The focus of this bug is that the UnhandledPromiseRejectionWarning is printed only under the following conditions:

only for function f3(),

only when executed under Electron (it is not printed under plain Node project), and,

only when the function is called asynchronously (from a setTimeout() callback)

If any of the above conditions is changed, the warning is not printed. It is not printed

for functions f1() and f2(), or,

when executed from plain Node.js project (Electron-specific parts should be removed from the script), or,

when the functions are called directly from the main script (not from setTimeout() callback)

I am looking to get answer/discussion to the following questions:

Why the UnhandledPromiseRejectionWarning warning is printed when executed from Electron but not when executed in a plain Node.js project?

Technical explanation of under-the-hood difference between f1/f2 and f3? Is an additional promise created/destroyed leading to some internal detection logic to complain? Why is the warning printed twice?

Why this happens only when executed from an asynchronous callback?

Is there any incorrect behavior in Electron or Node.js that should be fixed? If the outcome is correct, this means the code I submit is wrong. Can you point me to documentation or technical specification explaining why f3 is wrong or discouraged, if so?

const { app } = require('electron');

const f1 = async () => {
throw 'oops';
}

const f2 = () => {
return new Promise((_, reject) => {
reject('oops');
});
}

const f3 = async () => {
return new Promise((_, reject) => {
reject('oops');
});
}

setTimeout(() => {
f1().catch((error) => {
console.log('1 caught', error);
});
}, 1000);

setTimeout(() => {
f2().catch((error) => {
console.log('2 caught', error);
});
}, 2000);

setTimeout(() => {
f3().catch((error) => {
console.log('3 caught', error);
});
}, 3000);

setTimeout(() => app.exit(), 4000);

Output:

1 caught oops
2 caught oops
(node:21316) UnhandledPromiseRejectionWarning: oops
(node:21316) UnhandledPromiseRejectionWarning: oops
(node:21316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:21316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:21316) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:21316) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
3 caught oops
(node:21316) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 3)
(node:21316) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 3)