In this post I am just going to describe the how we can suppress all errors or some particular errors using error handling.
Suppressing all errors
Suppressing All Errors is very easy, all you need to do is just have blank catch statement for example
try
{
//some code
}
catch(e)
{ ; }
The above mentioned code will result in suppressing of all errors which is never recommended as it can lead to data integrity issues.
Just think user is entering some data and tries to save a record and the script written in write record results in some error. Now, user won’t see any error messages and he will think he has entered record properly where as it is not the case. So, we should never use this, until and unless we are pretty sure of what we are doing.
Suppressing particular errors:
There are some cases in which we know that a particular type of error can occur which is not going to affect the functionality and we would like to suppress that error. That can be done by the following the below given steps:
- Replicate the error in Application.
- Note down the text of the error (when the pop-up with error message is shown press CTRL+C and the error message will get copied)
- Every error has an error code associated to the text, note down the error code in the error message.
- For example
“A script failed to get the value for field Revision Number because the field was not active.(SBL-EXL-00119)”
for the above mentioned error the error code is SBL-EXL-00119. - Now the below mentioned code will suppress above mentioned error and give a pop-up if any other type of error occurs
try
{
//some code
}
catch(e)
{
var errtext = e.toString();
if(errtext.indexOf("SBL-EXL-00119") == -1)
TheApplication().RaiseErrorText("Error Occured");
}
To handle multiple errors you can have switch statement and basically do whatever you want to.
Well, this is the end of Error Handling series hope it would have helped you all. Post your comments and question in the meanwhile I will start working on another topic ![]()

(2 votes, average: 4 out of 5)
6 Comments at "try-catch-finally and throw - Final Part"
Hi Neel,
Thanks for the post…could you please explain regarding the -1 in the if statement..
thanks in advance..
So, -1 here means some other error has occured so, show the error message and in case if it contains the error message we want to suppress it will return a positive number denoting position of error code hence no error message and the error is suppressed.
Thanks a ton Neel…:)
Hi Neel,
Can you give me details about “How To make sure that memory is released or not once objects are nullified through script”
Thanks
Srinivas
Hi, Can you tell me details of the Siebel´s Reports Module?
Thanks!
i have a question, I have seen at times that developers write
catch(e)
{
Throw(e);
TheApplication().RaiseErrorText…..
}
I belive that in the above code Raise Error wont get fired..since throw e will cancel the opeartion there..
Help me understanding it.
Regards
Comment Now!