From 70fc0505b223f7bf17d3671d0532773359cf7858 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 20 Jun 2025 18:47:45 +0300 Subject: Implement proper exception hierarchy and consistent error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create base exception classes: - VSSimulatorException: Base checked exception for all simulator errors - VSSimulatorRuntimeException: Base unchecked exception for unrecoverable errors - Refactor existing exceptions to extend from base class: - VSEventNotCopyableException: Now includes better error messages - VSParseIntegerVectorException: Added constructors with cause support - VSNegativeNumberException: Added field name and value parameters - Add new specific exception types: - VSConfigurationException: For configuration errors - VSSerializationException: For save/load operations - VSProcessException: For process-related errors - VSProtocolException: For protocol execution errors - Create VSErrorHandler utility class: - Centralized error logging and user notification - Consistent error handling patterns - Helper methods for warning and error dialogs - Update exception handling in code: - VSClassLoader: Better error messages and specific exception handling - Timestamp events: Catch RuntimeException for custom actions - All 132 unit tests pass 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../exceptions/VSParseIntegerVectorException.java | 33 +++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'src/main/java/exceptions/VSParseIntegerVectorException.java') diff --git a/src/main/java/exceptions/VSParseIntegerVectorException.java b/src/main/java/exceptions/VSParseIntegerVectorException.java index 19c2b82..639b77e 100644 --- a/src/main/java/exceptions/VSParseIntegerVectorException.java +++ b/src/main/java/exceptions/VSParseIntegerVectorException.java @@ -1,13 +1,38 @@ package exceptions; /** - * The Interface VSParseIntegerVectorException, this exception is thrown if - * the VSAbstractEditor is not able to parse the vector fields input of the - * user. + * Exception thrown when the VSAbstractEditor cannot parse vector field input. + * This typically occurs when user input for vector values is malformed. * * @author Paul C. Buetow */ -public class VSParseIntegerVectorException extends Exception { +public class VSParseIntegerVectorException extends VSSimulatorException { /** The serial version uid */ private static final long serialVersionUID = 1L; + + /** + * Constructs a new parse integer vector exception. + */ + public VSParseIntegerVectorException() { + super("Failed to parse integer vector from input"); + } + + /** + * Constructs a new parse integer vector exception with the specified input string. + * + * @param input the input string that could not be parsed + */ + public VSParseIntegerVectorException(String input) { + super("Failed to parse integer vector from input: " + input); + } + + /** + * Constructs a new parse integer vector exception with the specified input and cause. + * + * @param input the input string that could not be parsed + * @param cause the underlying cause of the parse failure + */ + public VSParseIntegerVectorException(String input, Throwable cause) { + super("Failed to parse integer vector from input: " + input, cause); + } } -- cgit v1.2.3