SIL Script - How to get the error message from an SQL query ?

Christophe Chenavier January 26, 2021
try
{
  string [] results = sql("Jira","SELECT [Name] FROM [V_Institution]);
   runnerLog("SQL query completed");
}
catch string err
{
   runnerLog("SQL query failed : " + err);
}
catch {
   runnerLog("SQL query failed.");
}

Hi all,

The catch all clause will catch the exception when the sql query failed.
How can the script get the query error message to show it immediately to the user ?

Thanks in advance for your help.

2 answers

1 accepted

0 votes
Answer accepted
Christophe Chenavier February 18, 2021

So, here is the answer of the developer Radu Dumitriu : (It's not possible yet)

Anyway, I kept it in mind, and I wrote it on the ticket that lists the language improvements.

0 votes
mogavenasan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2021

Hi @Christophe Chenavier

Not sure what Jira app you are using to implement this SIL Script. I'm going to assume that you are using Power Scripts | Jira Workflow Automation. If yes, then you can use:

lfShowFieldMessage(field, message, messageClass) 

For more information, you may refer to lfShowFieldMessage

I hope that this helps.

Thanks,
Moga

Christophe Chenavier January 26, 2021

Hi Moga,

 

Yes I use PowerScript.

And yes I know lfShowFieldMessage.

But the problem here is not to display the message, but to get it.

 

Thanks for your answer.

mogavenasan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2021

From their documentation; Error handling - it looks like they are trying to keep it as user-friendly as possible by returning empty values rather than throwing exceptions where possible.

From what I can understand, if we use catch-all error, then we might not able to access the error. To confirm this, you might want to contact their support.

Christophe Chenavier January 28, 2021

I have no answer from the support so far.

I will post it when received.

Like mogavenasan likes this

Suggest an answer

Log in or Sign up to answer