How to get more specific error details from getErrorDetail() ?
Hi community,
we can use getErrorString() and getErrorDetail() to catch error information from failed queries.
getErrorString() only contains a short description, while getErrorDetail returns the short-description + some long text + some XML content.
Does anyone know a way to only get the xml part of getErrorDetails() that contain the item information?
I most of the time use getErrorString, but I have a use case for mass operations, where the xml part contains the relevant information if something went wrong.
I want to provide more precise feedback to the end users (what has failed exactly), but also use the xml information to call some "automatically repair if this error happens" function. But for this function I would need the item information in the xml part.
Does anyone has and idea to get more specific error details?
Thanks and best regards!
Angela
Use case is the following. I have an import feature for our custom Conflict Mineral Solution. Basically I read the data from the source document and add new items.
I use the proven concept from the end of this blog: https://aras.com/en/blog/aras-best-practices-server-side-code. Instead of doing multiple applies I execute one large AML query to add all the data.
Technically the use case is comparable to the mass import of Manufacturer Parts. Import only works if the "Manufacturer" exists in the database. If one Manufacturer is missing, the whole query will fail. But we cannot easy tell, which Manufacturer was missing. But I discovered that in my use case the missing Manufacturer/Smelter is Part of getErrorDetail().
The idea was to catch the Smelter number from getErrorDetail and open up a new Form so can add the missing smelter. That was the reason for the title of this post.
I want to avoid to use add/merge to add the missing data automatically. Conflict Mineral data is standardized, but companies show great creativity in not following the standard AT ALL. There is certain data that you just don´t want to automatically add to your db.
But I think I found a solution while writing this answer.
I was probably too focused on the "do something AFTER the error occured" concept. Maybe I should prevent the error from the start.
I could do one "get" query first with many logic or´s to check if we already know all the listed Manufacturers. Than match the result with the data we want to import. If data is missing, offer the user the option to add the missing elements before trying the actual import.
This should do the job. But I am open to even better ideas :).