function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mshelmanmshelman 

No error handling on dynamic soql?

This code

       try {
            return Database.query(soql);
        }      
        catch (QueryException e)    {
            this.errorString = 'There is a problem with your search parameters. Please check your search and try again.'; 
            return null; 
        }  
    
does not enter the catch block when a select query with a filter (criteria) of the wrong tyoe is attempted. It simply loads up the error page with: System.QueryException :unexpected token: ss. In other words it acts exactly the same as if there were no try/catch