Class ErrorHandler

java.lang.Object
utils.ErrorHandler

public class ErrorHandler extends Object
Centralized error and logging helper used across the UI and utilities. This class configures a file-based Logger and exposes convenience methods to log at common levels. It also provides a helper to display user-facing error dialogs while ensuring the technical details are written to the log file.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Logger
    Logger used for application diagnostics and error recording.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Private constructor to prevent instantiation of this utility class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    logError(String message, Throwable throwable)
    Log a severe error with an exception.
    static void
    logInfo(String message)
    Log an informational message.
    static void
    logWarning(String message)
    Log a warning message.
    static void
    showErrorToUser(String userMessage, String technicalDetails)
    Show a user-facing error dialog while logging technical details to the configured log file.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static final Logger logger
      Logger used for application diagnostics and error recording.
  • Constructor Details

    • ErrorHandler

      private ErrorHandler()
      Private constructor to prevent instantiation of this utility class.
  • Method Details

    • logError

      public static void logError(String message, Throwable throwable)
      Log a severe error with an exception.
      Parameters:
      message - short human-readable message
      throwable - throwable to include in the log
    • logWarning

      public static void logWarning(String message)
      Log a warning message.
      Parameters:
      message - warning text
    • logInfo

      public static void logInfo(String message)
      Log an informational message.
      Parameters:
      message - info text
    • showErrorToUser

      public static void showErrorToUser(String userMessage, String technicalDetails)
      Show a user-facing error dialog while logging technical details to the configured log file. This should be used for errors that require user attention.
      Parameters:
      userMessage - message shown to the user
      technicalDetails - technical details recorded in logs