Verify if "exception.Error" is null before getting "exception.Error.StatusCode"
Closed this issue ยท 9 comments
Hi Andre,
First of all, thanks for awesome library.
I just noted one small bug in the ServiceClient
class.
throw new Exception($"{exception.Error.Code} - {exception.Error?.Message ?? exception.Message}");
You verify if "Error" is null before trying to get the value of the Error.Message
property, but you don't do the same for Error.Code
. In this case, the application will throw a NullReferenceException
instead of the expected one.
Cheers.
Happens when you get the rate limit exception - which does not have an error property.
I don't wanna be a "party pooper", but I found this nuget package from Microsoft, which actually makes the use of this project unnecessary. (at least for me)
https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring
@luizs81 Nice :-)
Will try if it covers my use case (export / import of whole luis model).
@luizs81 I didn't known these Microsoft package (which was what led me to create this one). However, this idea is not just an SDK to be a "proxy" for the Programmatic APIs but rather more elaborate functions that help the developer at the time of use.
@luizs81
Works like a charm ๐
If I have time i will release a CLI based on the NuGet package (just covering my use case of export/import/train/publish).
@andreluizsecco I think it would make sense to base this project off the NuGet package then.
Maybe these elaborate functions could be released as a NuGet package of extension methods?
great package, i have checked the Microsoft one, but i cannot find the documentation of that package, so i stick with this
@michel-weber, yes, I was seriously considering leaving it just as an extension of the official SDK, however the @Bloodday comment led me to think that maybe this is not yet an hour due to the lack of official SDK documentation and some other factors. At the moment, I will continue to maintain it. Thanks for the contributions and feedbacks!
The CLI I wanted to write is already written by Microsoft:
https://github.com/Microsoft/botbuilder-tools/tree/master/packages/LUIS
Also check out the other tools:
https://github.com/Microsoft/botbuilder-tools