How Can I Get Better Errors From A Flow API
Comments
-
Do you have a recommended way for your clients who use the API when it comes to handling (deserializingparsing) the Fault exceptions thrown?
Examples
[i]System.ServiceModel.FaultException
1[DecisionsFramework.ServiceLayer.Utilities.FrameworkFault]: Object reference not set to an instance of an object. (Fault Detail is equal to DecisionsFramework.ServiceLayer.Utilities.FrameworkFault).[/i] [i] [/i] [i]System.ServiceModel.FaultException1[DecisionsFramework.ServiceLayer.Utilities.FrameworkFault]: [SecurityException] Username/Password is invalid. (Fault Detail is equal to DecisionsFramework.ServiceLayer.Utilities.FrameworkFault).[/i]
[i] [/i]
[i]System.ServiceModel.FaultException`1[DecisionsFramework.ServiceLayer.Utilities.FrameworkFault]: Exception of type DecisionsFramework.ServiceLayer.InvalidUserSessionException was thrown. (Fault Detail is equal to DecisionsFramework.ServiceLayer.Utilities.FrameworkFault).[/i]
[i]
[/i]
[i]
[/i]
These error messages dont tell us much on their own, and the full error message data only shows up in the Decisions UI. -
[font=Roboto, Arial, Helvetica, sans-serif]You can use a Catch Exception step in the flow youre calling, place a Create Data step after it, and generate a JSON-formatted error message to pass into the flows output. You can then check for an error in that output from the API call in the external code.[/font]
[font=Roboto, Arial, Helvetica, sans-serif]
[/font]
[font=Roboto, Arial, Helvetica, sans-serif]Attached is a rough example of how to configure a flow to return a JSON error message. You can specify a response code to work with if the flow returns an error, but the call itself will have a 200 response.[/font]