Skip to content

Error handling for bad git data in updatenotification#1507

Merged
MichMich merged 2 commits intoMagicMirrorOrg:developfrom
shbatm:bug-fix
Jan 4, 2019
Merged

Error handling for bad git data in updatenotification#1507
MichMich merged 2 commits intoMagicMirrorOrg:developfrom
shbatm:bug-fix

Conversation

@shbatm
Copy link
Contributor

@shbatm shbatm commented Jan 4, 2019

The updatenotification module did not ignore errors in the simple-git git.log() call. After some module updates on my installation I started seeing frequent UnhandledPromiseRejectionWarning errors:

1|mm  | 2019-01-04T09:00:09 <error> (node:947) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'hash' of null
1|mm  |     at /home/pi/MagicMirror/modules/default/updatenotification/node_helper.js:68:32
1|mm  |     at Git.<anonymous> (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1560:10)
1|mm  |     at done (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1432:21)
1|mm  |     at /home/pi/MagicMirror/node_modules/simple-git/src/git.js:1457:16 (process/warning.js:18 writeOut)
1|mm  | 2019-01-04T09:00:09 <error> (node:947) 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: 1) (process/warning.js:18 writeOut)
1|mm  | 2019-01-04T09:00:09 <error> (node:947) [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. (process/warning.js:18 writeOut)

This PR aborts the call if data2.latest is undefined for some reason. It is a nuisance error and the only negative side effect should be that we don't know if a module has an update; however, this is the same handling as if the fetch() call failed.

Related to closed issues #1164 and #1285.

@MichMich MichMich merged commit ebc57fe into MagicMirrorOrg:develop Jan 4, 2019
shbatm added a commit to shbatm/MagicMirror that referenced this pull request Jan 4, 2019
MichMich added a commit that referenced this pull request Jan 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants