NamoRamana 3 Posted November 26 When I catch any DB exception arising upon an execution of a query/sp, the "e.message" contains driver info text in the starting the message.. Example: e.message comes as: "[FireDAC][Phys][ODBC][Microsoft][SQL Server]Divide by zero error encountered." Is there any way to suppress the driver info from the actual exception text? Share this post Link to post
Brian 1 Posted November 28 Have you tried using regex? uses ... System.RegularExpressions; ... try ... // some database function except on E: EFDDBEngineException do begin ShowMessage(TRegEx.Replace(E.Message, '\[[^\]]*\]', '')); end; on E: Exception do begin ShowMessage('An unexpected error occurred: ' + E.Message); end; end; Share this post Link to post
Brian Evans 109 Posted November 28 That message comes from the underlying database so knowing which database is helpful in interpreting it. Seems counterproductive to be removing context from error messages. Share this post Link to post
Anders Melander 1803 Posted November 28 It also tells which layer produced the error. For example, was it the DB server, the DB client library, or FireDAC itself. It's technical info that provides important context to the developer/supporter. It's not meant to be presented to the user. Share this post Link to post
weirdo12 21 Posted November 30 On 11/26/2024 at 2:02 PM, NamoRamana said: Is there any way to suppress the driver info from the actual exception text? There isn't a property or global setting that will do that. Share this post Link to post