question

Upvotes
Accepted
3 0 0 3

Unhandled Exception: ThomsonReuters.RFA.Common.InvalidUsageException

our RFA quote souring application failed recently with the below error message.

Unhandled Exception: ThomsonReuters.RFA.Common.InvalidUsageException: Exception of type 'ThomsonReuters.RFA.Common.InvalidUsageException' was thrown.
at ThomsonReuters.RFA.SessionLayer.OMMConsumer.RegisterClient(EventQueue queue, OMMIntSpec cInterestSpec, Client client, Object closure) in c:\jenkins\workspace\dlibnetcore\os\vs140-64\rfawr\sessionlayer\ommconsumer.cpp:line 205
at BBSW.Tasks.RFA.MarketPrice.RDMDict.SendDictionaryRequest(String serviceName, Context ctx) in C:\bamboo-agent-home\xml-data\build-dir\BBSW-BBSWTAS33-JOB1\BBSW.Tasks.RFA.MarketPrice\RDMDict.cs:line 86
at BBSW.Tasks.RFA.MarketPrice.DictionaryManager.GetDict(String serviceName) in C:\bamboo-agent-home\xml-data\build-dir\BBSW-BBSWTAS33-JOB1\BBSW.Tasks.RFA.MarketPrice\DictionaryManager.cs:line 38

my questions:

1, in which cases, InvalidUsageException is thrown?

2, is there any way to log more details?

(we're using ROBUST FOUNDATION API 8.1)

treprfarfa-apierror
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
4.4k 10 6 9

Hi @tai.zhang

InvalidUsageException is thrown when; as the name imply; you invalidly use the function call.

This could be anything from null Client, invalid InterestSpec, or OMMConsumer has been destroyed.

You should try adding try/catch block to catch the invalid usage exception and print out the exception status text.

try
{
 handle = ommConsumer.RegisterClient(eventQueue,ommItemIntSpec,client,closure);
}
catch (InvalidUsageException exception)
{
 RFA_String excpStatusText = exception.Status.StatusText;
 //Print excpStatusText
}
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

thanks Warat.
we will do try..catch for sure. but this RegisterClient only crashes occasionally.
since RegisterClient is a built-in RFA function. i guess my question is for this method, at what scenarios, InvalidUsageException will be thrown.

i don't think OMMConsumer has been destroyed, as the log says "

at ThomsonReuters.RFA.SessionLayer.OMMConsumer.RegisterClient(EventQueue queue, OMMIntSpec cInterestSpec, Client client, Object closure) in c:\jenkins\workspace\dlibnetcore\os\vs140-64\rfawr\sessionlayer\ommconsumer.cpp:line 205

"

@tai.zhang

RFA .NET is a wrapper of RFA C++.

The exception was thrown from unmanaged RFA C++ code, which is not shown in the stack trace. And so I am afraid we cannot give the exact root cause from the stack. You need the exception status text.

However, the most common exception from RegisterClient is "OMMConsumer::registerClient() has been called with an item request prior to login request. Login request is expected first."

This could happen when the login request got rejected, but the application did not check that the login has been reject and sent the item request anyway.

thanks Warat. is any where i can find the souce code for

RegisterClient?

Show more comments
Click below to post an Idea Post Idea