Skip to content

Conversation

@haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Dec 18, 2020

Fixes #2350

  • Fixes a misplaced error check in osd tab where an argument is accessed after the user cancels the operation.
  • Added missing error checking in tethered logging tab.
  • Created utils/common.js for common used functions like checkChromeRuntimeError() and changed codebase to use this function.

Fixes: #2350

if (result.logging_file_entry) {
chrome.fileSystem.restoreEntry(result.logging_file_entry, function (entry) {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you just do console.error(chrome.runtime.lastError)? NW.js should be smart enough to dump the error message and stack trace in this case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prints Object instead of the message property. Caller or Callee properties are not accessible in strict mode.
Was looking for a utility or common file to put this kind of stuff to de-deduplicate like in serial.js but then with an extra line:

console.log((new Error).stack);

@mikeller mikeller added this to the 10.8.0 milestone Dec 18, 2020
@haslinghuis haslinghuis force-pushed the fix-chrome-errors branch 4 times, most recently from 46e32c0 to ca537df Compare December 19, 2020 01:07
@haslinghuis haslinghuis changed the title Fix and add check for chrome.runtime.lastError Fix and consolidate check for chrome.runtime.lastError Dec 19, 2020
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unchecked runtime.lastError: User Cancelled

2 participants