Activity Forums Salesforce® Discussions What are the different types of Exceptions in Salesforce?

  • madhulika shah

    Member
    August 16, 2018 at 10:17 am
  • shariq

    Member
    September 16, 2018 at 5:36 pm

    Hi,

    AsyncException
    Any problem with an asynchronous operation, such as failing to enqueue an asynchronous call.
    CalloutException
    Any problem with a Web service operation, such as failing to make a callout to an external system.
    DmlException
    Any problem with a DML statement, such as an insert statement missing a required field on a record.
    EmailException
    Any problem with email, such as failure to deliver. For more information, see Outbound Email.
    ExternalObjectException
    Any problem with external object records, such as connection timeouts during attempts to access the data that’s stored on external systems.
    InvalidParameterValueException
    An invalid parameter was supplied for a method or any problem with a URL used with Visualforce pages. For more information on Visualforce, see the Visualforce Developer's Guide.
    LimitException
    A governor limit has been exceeded. This exception can’t be caught.
    JSONException
    Any problem with JSON serialization and deserialization operations. For more information, see the methods of System.JSON, System.JSONParser, andSystem.JSONGenerator.
    ListException
    Any problem with a list, such as attempting to access an index that is out of bounds.
    MathException
    Any problem with a mathematical operation, such as dividing by zero.
    NoAccessException
    Any problem with unauthorized access, such as trying to access an sObject that the current user does not have access to. This is generally used with Visualforce pages. For more information on Visualforce, see the Visualforce Developer's Guide.
    NoDataFoundException
    Any problem with data that does not exist, such as trying to access an sObject that has been deleted. This is generally used with Visualforce pages. For more information on Visualforce, see the Visualforce Developer's Guide.
    NoSuchElementException
    This exception is thrown if you try to access items that are outside the bounds of a list. This exception is used by the Iterator next method. For example, ifiterator.hasNext() == false and you call iterator.next(), this exception is thrown. This exception is also used by the Apex Flex Queue methods and is thrown if you attempt to access a job at an invalid position in the flex queue.
    NullPointerException
    Any problem with dereferencing null, such as in the following code:1
    String s;
    s.toLowerCase(); // Since s is null, this call causes
     // a NullPointerException
    QueryException
    Any problem with SOQL queries, such as assigning a query that returns no records or more than one record to a singleton sObject variable.
    RequiredFeatureMissing
    A Chatter feature is required for code that has been deployed to an organization that does not have Chatter enabled.
    SearchException
    Any problem with SOSL queries executed with SOAP API search() call, for example, when the searchString parameter contains less than two characters. For more information, see the SOAP API Developer Guide.
    SecurityException
    Any problem with static methods in the Crypto utility class. For more information, see Crypto Class.
    SerializationException
    Any problem with the serialization of data. This is generally used with Visualforce pages. For more information on Visualforce, see the Visualforce Developer's Guide.
    SObjectException
    Any problem with sObject records, such as attempting to change a field in an updatestatement that can only be changed during insert.
    StringException
    Any problem with Strings, such as a String that is exceeding your heap size.
    TypeException
    Any problem with type conversions, such as attempting to convert the String 'a' to an Integer using the valueOf method.
    VisualforceException
    Any problem with a Visualforce page. For more information on Visualforce, see the Visualforce Developer's Guide.
    XmlException
    Any problem with the XmlStream classes, such as failing to read or write XML.

    The following is an example using the DmlException exception:

    Account[] accts = new Account[]{new Account(billingcity = 'San Jose')};
    try {
    insert accts;
    } catch (System.DmlException e) {
    for (Integer i = 0; i < e.getNumDml(); i++) {
    // Process exception here
    System.debug(e.getDmlMessage(i));
    }
    }

    Hope this helps.

  • Parul

    Member
    September 21, 2018 at 10:05 pm

    List of possible exception:

    Here they are:

    AsyncException
    CalloutException
    DmlException
    EmailException
    ExternalObjectException
    InvalidParameterValueException
    LimitException
    JSONException
    ListException
    MathException
    NoAccessException
    NoDataFoundException
    NoSuchElementException
    NullPointerException
    QueryException
    RequiredFeatureMissing
    SearchException
    SecurityException
    SerializationException
    SObjectException
    StringException
    TypeException
    VisualforceException
    XmlException

     

    Thanks

  • Unknown Member

    Deleted User
    November 24, 2020 at 7:51 am

    Best MLM Software Development ServiceNeo MLM Mobile Apps DevelopmentFlexible, Reliable And Intuitive Platform To Support Your Business Endeavours
    It is why our Neo MLM mobile apps improvement platform is of paramount significance in case you want your enterprise to thrive and drive life-converting attention of opportunities supplied by the businesses worldwide.Our software program solution presents a non-stop guide, so whether or not you want to devise, prepare, execute, manipulate or acquire reports on the modern day tendencies at some point of your network by using using our reliable and intuitive platform, now you can!Network Marketing is the job of "searching" and "sorting" people that will suit you, your product, and the business opportunity you offer.Once you have done a job and when you are continuously getting a profit from it, then that is called PASSIVE INCOME! It is also called residual or REPEATING revenue. You do the job once, and after you have a regular income, without having to do anything else!In Network Marketing, you are free to be creative, to choose when, with whom, where and how you will manage your business.

    https://neomlmsoftware.com/<gwmw></gwmw&gt;

  • Marziya

    Member
    November 24, 2020 at 11:21 am
    • AsyncException. Any problem with an asynchronous operation, such as failing to enqueue an asynchronous call.
    • CalloutException. ...
    • DmlException. ...
    • EmailException. ...
    • ExternalObjectException. ...
    • InvalidParameterValueException. ...
    • LimitException. ...
    • JSONException.

Log In to reply.

Popular Salesforce Blogs