Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public with sharing class BusinessException extends Exception
- {
- public static void recordError(String fileName, String methodName, String errorMessage)
- {
- Exception__c newException = createError(fileName, methodName, errorMessage);
- insertError(newException);
- }
- private static Exception__c createError(String fileName, String methodName, String errorMessage)
- {
- Exception__c result = new Exception__c();
- result.FileName__c = fileName;
- result.MethodName__c = methodName;
- result.SystemError__c = errorMessage;
- return result;
- }
- private static void insertError(Exception__c oopsey)
- {
- try
- {
- insert oopsey;
- }
- catch(DMLException dmlError)
- {
- }
- }
- }
- try
- {
- //something
- }
- catch(QueryException error)
- {
- BusinessException.recordError('File_Name', 'Method Name', error);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement