<p dir="auto">There was some recent confusion on my team about why <a href="https://github.com/electron/electron/releases/tag/v1.7.10">https://github.com/electron/electron/releases/tag/v1.7.10</a> lists downloads for both <code class="notranslate">arm</code> and <code class="notranslate">armv7l</code>, when <a href="https://electronjs.org/docs/tutorial/supported-platforms" rel="nofollow">https://electronjs.org/docs/tutorial/supported-platforms</a> only mentions the <code class="notranslate">arm</code> architecture.</p>
<p dir="auto">After more confusion and a bit of searching I eventually found <a href="https://github.com/electron/electron/blob/master/docs/tutorial/planned-breaking-changes.md#duplicate-arm-assets">https://github.com/electron/electron/blob/master/docs/tutorial/planned-breaking-changes.md#duplicate-arm-assets</a> which cleared up the confusion, but it would be great if that info (i.e. the fact that <code class="notranslate">arm</code> and <code class="notranslate">armv7l</code> are currently identical) was also added to <a href="https://electronjs.org/docs/tutorial/supported-platforms" rel="nofollow">https://electronjs.org/docs/tutorial/supported-platforms</a> to stop anybody else getting similarly confused <g-emoji class="g-emoji" alias="wink" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f609.png">😉</g-emoji></p>
<h3 dir="auto">Preflight Checklist</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the issue tracker for an issue that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>v9.0.0</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>Windows 10 (1909)</li>
</ul>
</li>
<li><strong>Last Known Working Electron version:</strong>
<ul dir="auto">
<li>Not sure</li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">UnhandledPromiseRejectionWarning warnings should not be printed since all promise rejections are handled.<br>
Similar script executed in plain Node.js project (not Electron) with recent Node version (v12.16.1) does not produce these warnings.</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">UnhandledPromiseRejectionWarning warnings are printed even though all promise rejections are handled.</p>
<h3 dir="auto">To Reproduce</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="git clone https://github.com/ivanggq/electron-async-vs-promise-issue.git -b master
cd electron-async-vs-promise-issue/
npm install
npm start"><pre class="notranslate">git clone https://github.com/ivanggq/electron-async-vs-promise-issue.git -b master
<span class="pl-c1">cd</span> electron-async-vs-promise-issue/
npm install
npm start</pre></div>
<h3 dir="auto">Screenshots</h3>
<h3 dir="auto">Additional Information</h3>
<p dir="auto">The focus of this bug is that the UnhandledPromiseRejectionWarning is printed only under the following conditions:</p>
<ul dir="auto">
<li>only for function f3(),</li>
<li>only when executed under Electron (it is not printed under plain Node project), and,</li>
<li>only when the function is called asynchronously (from a setTimeout() callback)</li>
</ul>
<p dir="auto">If any of the above conditions is changed, the warning is not printed. It is not printed</p>
<ul dir="auto">
<li>for functions f1() and f2(), or,</li>
<li>when executed from plain Node.js project (Electron-specific parts should be removed from the script), or,</li>
<li>when the functions are called directly from the main script (not from setTimeout() callback)</li>
</ul>
<p dir="auto">I am looking to get answer/discussion to the  following questions:</p>
<ul dir="auto">
<li>Why the UnhandledPromiseRejectionWarning warning is printed when executed from Electron but not when executed in a plain Node.js project?</li>
<li>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?</li>
<li>Why this happens only when executed from an asynchronous callback?</li>
<li>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?</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const { app } = require('electron');

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

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

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

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

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

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

setTimeout(() =&gt; app.exit(), 4000);"><pre class="notranslate"><code class="notranslate">const { app } = require('electron');

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

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

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

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

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

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

setTimeout(() =&gt; app.exit(), 4000);
</code></pre></div>
<p dir="auto">Output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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)"><pre class="notranslate"><code class="notranslate">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)
</code></pre></div>