Class ErrorManager

java.lang.Object
me.neznamy.tab.shared.ErrorManager

public class ErrorManager extends Object
An error assistant to print internal errors into error file and warn user about misconfiguration
  • Constructor Details

    • ErrorManager

      public ErrorManager()
  • Method Details

    • printError

      public void printError(String message)
      Prints error message into errors.log file
      Parameters:
      message - message to print
    • printError

      public void printError(String message, Throwable t)
      Prints error message and stack trace into errors.log file
      Parameters:
      message - message to print
      t - thrown error
    • printError

      public void printError(String message, Throwable t, boolean intoConsoleToo)
      Prints error message and stack trace into errors.log file
      Parameters:
      message - message to print
      t - thrown error
      intoConsoleToo - if the message should be printed into console as well or not
    • printError

      public void printError(String message, Throwable t, boolean intoConsoleToo, File file)
      Prints error message and stack trace into specified file
      Parameters:
      message - message to print
      t - thrown error
      intoConsoleToo - if the message should be printed into console as well or not
      file - file to print error to
    • placeholderError

      public void placeholderError(String message, Throwable t)
      Prints error message thrown by placeholder and stack trace into placeholder-errors.log file
      Parameters:
      message - message to print
      t - thrown error
    • placeholderError

      public void placeholderError(String message, List<String> t)
      Prints error message thrown by placeholder and stack trace into placeholder-errors.log file
      Parameters:
      message - message to print
      t - thrown stack trace elements
    • criticalError

      public void criticalError(String message, Throwable t)
      Prints error message and stack trace into errors.log file as well as the console
      Parameters:
      message - message to print
      t - thrown error
    • parseInteger

      public int parseInteger(String string, int defaultValue)
      Parses integer in given string and returns it. Returns second argument if string is not valid.
      Parameters:
      string - string to parse
      defaultValue - value to return if string is not valid
      Returns:
      parsed integer or defaultValue if input is invalid
    • parseFloat

      public float parseFloat(String string, float defaultValue)
      Parses float in given string and returns it. Returns second argument if string is not valid.
      Parameters:
      string - string to parse
      defaultValue - value to return if string is not valid
      Returns:
      parsed float or defaultValue if input is invalid
    • parseDouble

      public double parseDouble(String string, double defaultValue)
      Parses double in given string and returns it. Returns second argument if string is not valid.
      Parameters:
      string - string to parse
      defaultValue - value to return if string is not valid
      Returns:
      parsed float or defaultValue if input is invalid
    • fixAnimationInterval

      public int fixAnimationInterval(String name, int interval)
      Makes interval divisible by 50 and sends error message if it was not already or was 0 or less
      Parameters:
      name - name of animation used in error message
      interval - configured change interval
      Returns:
      fixed change interval
    • fixAnimationFrames

      public List<String> fixAnimationFrames(String name, List<String> list)
      Returns the list if not null, empty list and error message if null
      Parameters:
      name - name of animation used in error message
      list - list of configured animation frames
      Returns:
      the list if it's valid, singleton list with "<Invalid Animation>" otherwise
    • startupWarn

      public void startupWarn(String message)
      Sends a startup warn message into console
      Parameters:
      message - message to print into console
    • missingAttribute

      public void missingAttribute(String objectType, Object objectName, String attribute)
      Sends a startup warn about missing object parameter
      Parameters:
      objectType - object type missing parameter
      objectName - name of object
      attribute - missing parameter
    • getAntiOverrideLog

      public File getAntiOverrideLog()
      Returns anti-override.log file
      Returns:
      anti-override.log file