getTracklist error handling

To discuss development of addons / skins / customization of MediaMonkey.

Moderator: jiri

TIV73
Posts: 108
Joined: Sat Nov 12, 2011 1:31 pm
Contact:

getTracklist error handling

Post by TIV73 »

Hi everybody,
I noticed that executing app.db.getTracklist with an invalid query throws an exception which leaves mediamonkey unresponsive and I couldn't find a way to handle these errors.
Basically, what I'm trying to do is opening the console and running the following code

Code: Select all

app.db.getTracklist('SELECT * FROM SONGS', -1).whenLoaded().then(function () {
	console.log('ok')
}).catch((err) => {
  console.log(err)  
})
Which works fine, but once I use an invalid query in the example above, mediamonkey (rightly) complains that there was a problem executing the query, followed by a javascript error and a new promt asking if I want to restart the application. Unless I do so, mediamonkey becomes completely unresponsive, forcing me to kill the process.

getQueryResultAsync behaves slightly different:

Code: Select all

app.db.getQueryResultAsync('SELECT * FROM SONGS').then(function (result) {
	console.log('ok')
}).catch((err) => {
  console.log(err)  
})
If I execute the code above with an invalid query, the initial DB error is also pops up but mediamonkey remains usable. Another thing I noticed is that getQueryResultAsync executes the error handler and writes the error message to the log where getTracklist crashes the application before it comes to that part.

Does anybody know how I can prevent getTracklist from crashing mediamonkey or, even better, a method to handle these kind of exceptions before the users sees them?
PetrCBR
Posts: 1702
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: getTracklist error handling

Post by PetrCBR »

Will fix getTracklist method so it will work same as getQueryResultAsync.
TIV73
Posts: 108
Joined: Sat Nov 12, 2011 1:31 pm
Contact:

Re: getTracklist error handling

Post by TIV73 »

Much appreciated!
Post Reply