Hi,
I would like to try to catch an error on getDataSetByQuery
_query = 'SELECT * from myTable where col1=? and col2=?'
try
{
_ds = databaseManager.getDataSetByQuery('myServer' ,_query, [_arg1, _arg2], -1)
}
catch (e)
{
_message = e.getMessage();
}
For example if the table doesn’t exist or an other error in the query
When I put a global method in the onError property on the solution, then I get the error in the errorhandler
When I don’t put a global method as errorhandler AND I don’t use the try{} catch{}, then the error appears in a pop-up message and also in the console within developer.
But in this case I don’t want to use the errorhandler, but want to use try/catch and would like to have the errormessage as result.
There isn’t a foundset involved here, so there are no failedRecords, so I can’t check the exception of records.
And I can’t either use the
_message = _ds.getException()
because the result is not a JSDataset.
So how can I get the errormessage in this case?
I would have expected that the catch{e} has e as argument and I find the message as property of e, but that is also not the case.
What else can I do, except to put in my catch{} part
_message = 'Query failed'
without knowing for what reason the query failed.