afv-library/skills/apex-class/templates/exception.cls
Mohan Raj Rajamanickam 2320c50264
ci: publish skills as @salesforce/afv-skills npm package @W-21534193@ (#30)
* ci: update package details and add GitHub workflows for skills validation and release

* chore: update Node version, change license, and refactor skills validation script to TypeScript

* chore: remove unused deps

* fix: npm package

* fix: flatten skills to pass validation

* chore: add validation script to package.json and update GitHub workflow to use it

* chore: enhance skills validation and update workflows for npm publishing

* refactor: streamline skills validation process in workflow and script

* refactor: improve documentation and structure of skills validation script

* implement checks based on jeff's best practices doc

* chore: add pull request template for skill submissions

* chore: update pull request template with additional references and improve automated checks section

* chore: update pull request template to clarify naming convention with a warning for gerund form

* chore: update pull request template to reference skill authoring guide and enhance checklist structure

* chore: enhance GitHub workflows for skills validation and release process

* refactor: improve parsing logic for SKILL.md files and enhance error collection in validation

* chore: update validation checks to enforce character limits for skill names and descriptions

* fix: remove unnecessary whitespace in footer string in validate-skills.ts
2026-03-12 13:41:52 -07:00

52 lines
1.8 KiB
OpenEdge ABL

/**
* @description Custom exception for {describe when this exception is thrown}.
* Use this exception to signal domain-specific errors that callers
* can catch and handle distinctly from system exceptions.
* @author Generated by Apex Class Writer Skill
*
* @example
* throw new {ClassName}('Account merge failed: duplicate detected.');
*
* // Wrap a caught exception
* try {
* // ... risky operation
* } catch (DmlException e) {
* throw new {ClassName}('DML failed during account merge: ' + e.getMessage());
* }
*/
public with sharing class {ClassName} extends Exception {
// Apex custom exceptions automatically inherit:
// - getMessage()
// - getCause()
// - getStackTraceString()
// - setMessage(String)
// - initCause(Exception)
//
// And support these constructor patterns:
// - new {ClassName}()
// - new {ClassName}('message')
// - new {ClassName}(causeException)
// - new {ClassName}('message', causeException)
//
// Note: Apex does NOT support custom constructors on Exception subclasses.
// To add context, use the message string or create a wrapper pattern:
//
// Example wrapper pattern (if you need structured error data):
//
// public class {ClassName}Detail {
// public String errorCode;
// public List<Id> failedRecordIds;
// public String detail;
//
// public {ClassName}Detail(String errorCode, List<Id> failedRecordIds, String detail) {
// this.errorCode = errorCode;
// this.failedRecordIds = failedRecordIds;
// this.detail = detail;
// }
//
// public override String toString() {
// return '[' + errorCode + '] ' + detail + ' (Records: ' + failedRecordIds + ')';
// }
// }
}