Skip to main content

Power BI

New

Extract OData error from OData, even when HTTP Streaming is used by OData producer

Vote (7) Share
Guido Leenders's profile image

Guido Leenders on 19 Dec 2022 10:40:38

Most OData-producers use HTTP Streaming to start shipping data to the OData-consumer as early as possible, allowing the consumer to process the data while more is being generated to reduce runtime duration as well as memory footprint across all stages.


However, when the producer includes an OData error in the output stream, this only seems to be detected and handled meaningful when it is returned at start of the stream.


OData errors included in the stream after the first character has been returned are not picked up by Power BI. We have several thousands of users across approximately the same number of companies and each one has to be trained what to do in that case. For now, we train them and send them an email when deemed possible to use a different user interface than Power BI to see the actual error instead of


DataSource.Error: OData: Invalid JSON. A comma character ‘,’ was expected in scope ‘Array’. Every two elements in an array and properties of an object must be separated by commas.


In fact, a related page on our forums is one of the most popular pages on Google for various related search terms.


Our own OData-consumers have some mechanism in place that look at the JsonReaderException and using the LinePosition attribute search for a possibly present OData error and display it. However, we can not provide a PR for Power BI.


It would reduce frustrations with our users tremendously when Power BI as OData-consumer could also extract the relevant OData-error even when HTTP Streaming is used.


Sample JSON with OData-error in the stream:


{"@odata.context":"https://bridge-online.cloud/acme-exact-online/odata4/$metadata#ExactOnlineREST.Incremental.GoodsDeliveryLinesIncremental@eol","value":[{"Timestamp":12745208078,"Created":"2022-12-14T07:21:28.32Z","Creator":"a230905c-541b-41dd-8455-229f21cc56d5","DeliveryDate":"2022-12-14T00:00:00Z","Description":"... 400 x 400 x 50","Division":338762,"EntryID":"5b4e4a14-b39f-4bae-b2f5-b23b317ecbc3","ID":"2147360b-aa4d-4896-8005-706fdb611922","Item":"a9d6923e-e119-4159-9b17-dbf44fabcaad","LineNumber":1,"Modified":"2022-12-14T07:21:28.32Z","Modifier":"a230905c-541b-41dd-8455-229f21cc56d5","QuantityDelivered":1.0,"QuantityOrdered":1.0,"SalesOrderLineID":"8b35d31a-8590-4519-8c8c-3f28ddf53097","SalesOrderNumber":1234567,"StorageLocation":"3ace26f6-d53d-4726-b7bb-367becfcf4f9","Unitcode":"-"},{"Timestamp":12745208107,"Created":"2022-12-14T07:21:28.867Z","Creator":"a230905c-541b-41dd-8455-229f21cc56d5","DeliveryDate":"2022-12-14T00:00:00Z","Skipped": "300.000 characters removed","Unitcode":"stuk"},{"Timestamp":12746454444,"Created":"2022-12-14T14:23:28.96Z","Creator":"6ab47e8d-e955-4c9d-8da9-9a7579f0c133","DeliveryDate":"2022-12-14T00:00:00Z","Description":"Ringtong ...","Division":338762,"EntryID":"080a2366-2156-420a-9a30-f43d874dc541","ID":"26bf29f2-8a11-4574-82fa-e0233983648d","Item":"09b172b7-10b2-44cc-a0a3-dcb4eee9ba77","LineNumber":1,"Modified":"2022-12-14T14:23:28.96Z","Modifier":"6ab47e8d-e955-4c9d-8da9-9a7579f0c133","QuantityDelivered":1.0,"QuantityOrdered":2.0,"SalesOrderLineID":"2400a5ec-9de5-41ef-9c6e-ec2b1bd249d8","SalesOrderNumber":123456,"StorageLocation":"2fef0dc6-b07f-435f-b4c6-edd2c44466ac","Unitcode":"stuk"}{"error":{"code":"itgeneor643","message":"Er is een interne fout opgetreden. Neem contact op met uw leverancier. (itgeneor643, aa08f467-2c73-4ff7-936b-57338e129230)","target":null,"details":[{"code":"aa08f467-2c73-4ff7-936b-57338e129230","target":null,"message":"Unique ID"}],"innererror":null}}