Activity Forums Salesforce® Discussions Is there any way to handle salesforce internal error for invalid or non existing custom label?

  • Neha

    Member
    March 22, 2018 at 6:37 am

    Hi Rounak,
    Internal Server Errors are just that; errors that occur in the runtime environment that are not accounted for. For example, the runtime knows how to express a NullPointerException, but it doesn't know how to handle something like a missing translation. You can observe this in action with the following code (as of the time of this answer, anyways):

    System.debug(
    Id.valueOf('00Y000000000000').getSObjectType()
    .getDescribe().getLabel()
    );
    Once the system encounters a situation it can't handle, the only thing it can safely do is to abort the current transaction, log the error, and inform the user. The reason why your Apex Code can't handle the exception is because it's occurring in the underlying runtime system.

    If you've ever had a Blue Screen of Death on a Windows system, you could consider it to be roughly analogous to what's happening with an Internal Server Error. A BSoD halts the system so that no further damage can occur to the system. Similarly, an Internal Server Error halts the transaction so that the underlying system doesn't crash entirely.

    If you want to determine the existence of a label, you're going to have to use an alternative API, such as the Metadata API wrapper.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos