Starting with Spring ’12, the Self-Service portal isn’t available for new orgs. Existing orgs continue to have access to the Self-Service portal.
Aptitude
(12)
C
(2)
C++
(10)
CSS
(1)
Data Structure
(2)
English
(6)
Fitness
(2)
General
(14)
HTML
(3)
Integration
(1)
Itinerary and Travel Cost
(2)
Java
(29)
JQ
(5)
JS
(5)
JSP
(1)
Lightning
(14)
logical
(3)
Lyrics
(1)
Math
(1)
Music Notation
(20)
MySql
(4)
Network
(1)
Regex
(1)
salesforce
(131)
Servlet
(4)
SF Admin
(31)
SF Dev
(102)
Spiritual Content
(3)
SQL
(4)
SQL_SERVER
(1)
StudyPoints
(2)
Trips
(1)
ytChannels
(2)
अन्ताक्षरी
(4)
Creating Custom Exceptions
Since we can’t throw built-in Apex exceptions but can only catch them, we can create custom exceptions to throw in your methods. That way, we can also specify detailed error messages and have more custom error handling in catch blocks.
To create custom exception class, extend the built-in Exception class and make sure your class name ends with the word Exception. Append extends Exception after your class declaration as follows.
-------------------------------------------------
public
class
MyException
extends
Exception {}
------------------------------
public class Utility {
public static void insertMethod() {
try {
} catch(DmlException e) {
throw new MyException
(
'my Custom exception message.', e);
}
}
}
Subscribe to:
Posts (Atom)