Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnhandledPromiseRejectionWarning: SyntaxError: Unexpected number in JSON at position 10 #158

Open
SarathKmrM opened this issue Dec 29, 2022 · 8 comments

Comments

@SarathKmrM
Copy link

SarathKmrM commented Dec 29, 2022

Hi team

The module is working fine, but I am getting errors on some specific sites and applications.
I am getting below error on https://gitlab.com/users/sign_in
Open above link on the browser and try to get activeWindow(), you can find this error

(node:16684) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected number in JSON at position 10
    at JSON.parse (<anonymous>)
    at parseLinux (/var/www/html/focusro-electron-app-apptrack/focusro-app/node_modules/active-win/lib/linux.js:49:15)
    at getWindowInformation (/var/www/html/focusro-electron-app-apptrack/focusro-app/node_modules/active-win/lib/linux.js:92:15)
    at async Timeout._onTimeout (/var/www/html/focusro-electron-app-apptrack/focusro-app/electron-main.js:455:28)
(node:16684) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

Why is this happening ? any solutions ?
I am using 8.0.2 version.
thanks in advance

@seantaylorgmi
Copy link

+1

2 similar comments
@shunmuga-sundaram
Copy link

+1

@richardkevinbox
Copy link

+1

@samkennardg
Copy link

i am also facing this issue

@ReginaLisa
Copy link

+1

2 similar comments
@nikess
Copy link

nikess commented Mar 21, 2023

+1

@sarathkmrdev
Copy link

+1

@asukaminato0721
Copy link

asukaminato0721 commented May 4, 2023

https://github.com/sindresorhus/active-win/blob/27221e5da0a64025bdec8759605694ea84ff9f68/lib/linux.js#L47-L54

I meet the same problem, after some debug, I change to

	return {
		platform: 'linux',
		title: result['_NET_WM_NAME(UTF8_STRING)'] || result['WM_NAME(STRING)'] || null,
		id: windowId,
		owner: {
			name: result['WM_CLASS(STRING)'].split(',').pop(),
			processId
		},

well, at least it kind of works.

{
  platform: 'linux',
  title: '"apptimer : apptimer \\342\\200\\224 Konsole"',
  id: 150994959,
  owner: { name: ' "konsole"', processId: 169925, path: '/usr/bin/konsole' },
  bounds: { x: 0, y: 42, width: 1920, height: 994 },
  memoryUsage: 217608192
}

about windowId, I found that it will have some problems when listening to a browser or a wine app. For example: become undefined.


and doesn't support CJK


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

No branches or pull requests

9 participants