Better exceptions


#1

I’ve started to evaluate Okta for integration to my web site to use it for user management. As a test I created a user (via the API) that didn’t meet the password policy. I got back a verbose text mixed in with callstack data and class names (I think it was) mixed in with the rule name that triggered the failure. How am I supposed to show this to the end user? These error messages/exceptions have to be structured so they can be interpreted by code and properly localized, etc.


#2

You can use the errorSummary key of the json response to parse and show the error to the users.
You can also use one of the language SDKs instead which will handle error management for you.


#3

I am using the .NET library and they suggested I should open a suggestion here. The errorSummary is not exposed in the .NET library, this is what the exception looks like.

image

Reference: https://github.com/okta/okta-sdk-dotnet/issues/176


#4

But my comment about having a code is still valid, if I need this message to be shown in a different language then I can’t rely on the errorCauses text, I need some kind of “code” that I can use for reference to a language string. The E0000001 ErrorCode seems to be too generic, I got that even when there were missing properties on the CreateUser call.