Interface ErrorHandler

All Known Implementing Classes:
DefaultErrorHandler, LogErrorHandler

public interface ErrorHandler
Handle CSS errors at the CSSDocument.
See Also:
  • Method Details

    • hasPolicyErrors

      boolean hasPolicyErrors()
      Check whether this handler has processed any policy errors.
      Returns:
      true if this handler processed any policy errors.
    • hasComputedStyleErrors

      boolean hasComputedStyleErrors()
      Check whether this handler has processed computed style errors.

      Presentational hint errors are included in this category, as they are found during style computation.

      Returns:
      true if this handler processed computed style errors.
    • hasComputedStyleErrors

      boolean hasComputedStyleErrors(CSSElement element)
      Check whether this handler has processed computed style errors for the given element.

      Presentational hint errors are included in this category, as they are found during style computation.

      Parameters:
      element - the element.
      Returns:
      true if this handler processed computed style errors.
    • hasMediaErrors

      boolean hasMediaErrors()
      Check whether this handler has processed any media-related errors.
      Returns:
      true if this handler processed any media-related errors.
    • hasIOErrors

      boolean hasIOErrors()
      Check whether this handler has processed any I/O errors.
      Returns:
      true if this handler processed any I/O errors.
    • hasErrors

      boolean hasErrors()
      Check whether this handler has processed any non-transient error.

      I/O errors are not taken into account by this method.

      Returns:
      true if this handler processed any non-transient errors.
    • hasComputedStyleWarnings

      boolean hasComputedStyleWarnings()
      Check whether this handler has processed computed style warnings.
      Returns:
      true if this handler processed computed style warnings.
    • hasComputedStyleWarnings

      boolean hasComputedStyleWarnings(CSSElement element)
      Check whether this handler has processed computed style warnings for the given element.
      Parameters:
      element - the element.
      Returns:
      true if this handler processed computed style warnings.
    • hasMediaWarnings

      boolean hasMediaWarnings()
      Check whether this handler has processed any media-related warnings.
      Returns:
      true if this handler processed any media-related warnings.
    • hasWarnings

      boolean hasWarnings()
      Check whether this handler has processed any warnings.
      Returns:
      true if this handler processed any warnings.
    • policyError

      void policyError(Node node, String message)
      Report a policy error, including possible security issues.
      Parameters:
      node - the node that caused the policy violation, or where it was detected.
      message - a message describing the error.
    • linkedStyleError

      void linkedStyleError(Node ownerNode, String message)
      Report an error related to linked style, where it was not possible to create the style sheet linked from node due to an issue with the given node or other node in the document (as opposed to an issue with the linked style sheet itself).
      Parameters:
      ownerNode - the node where the error happened.
      message - a message describing the error.
    • mediaQueryError

      void mediaQueryError(Node ownerNode, CSSMediaException exception)
      Report a media query error.
      Parameters:
      ownerNode - the node that ultimately owns the sheet or rule where the media query appears (even if it is inside a nested sheet/rule, the node responsible is the one that owns the top-most style sheet).
      exception - the exception describing the error.
    • mediaQueryWarning

      void mediaQueryWarning(Node ownerNode, CSSMediaException exception)
      Report a media query warning.
      Parameters:
      ownerNode - the node that ultimately owns the sheet or rule where the media query appears (even if it is inside a nested sheet/rule, the node responsible is the one that owns the top-most style sheet).
      exception - the exception describing the issue.
    • linkedSheetError

      void linkedSheetError(Exception exception, CSSStyleSheet<? extends CSSRule> sheet)
      Report an error associated to a LinkStyle style sheet (i.e. LINK or STYLE elements), that caused an exception to be thrown.
      Parameters:
      exception - the exception describing the problem.
      sheet - the linked or embedded style sheet.
    • ruleIOError

      @Deprecated(forRemoval=true) default void ruleIOError(String uri, IOException exception)
      Deprecated, for removal: This API element is subject to removal in a future version.
      A I/O error was produced when retrieving a resource while processing a rule, generally an @import or @font-face rule.
      Parameters:
      uri - the uri for the resource.
      exception - the exception describing the problem.
      See Also:
    • ioError

      void ioError(String uri, IOException exception)
      A I/O error was found when retrieving a resource while processing an attribute (usually href) or a rule, generally an @import or @font-face rule.
      Parameters:
      uri - the uri for the resource.
      exception - the exception describing the problem.
    • getInlineStyleErrorHandler

      StyleDeclarationErrorHandler getInlineStyleErrorHandler(CSSElement owner)
      Get the error handler for the given element's inline style.
      Parameters:
      owner - the element that owns the inline style.
      Returns:
      the style's error handler. Implementations are allowed to return null if the element has no inline style.
    • inlineStyleError

      void inlineStyleError(CSSElement owner, Exception exception, String inlineStyle)
      Report a problem with setting an inline style, that caused an exception to be thrown by lower-level parsing (NSAC).

      This method is triggered only in two (unlikely) cases:

      1. If a problem appears when instantiating a NSAC parser.
      2. When the NSAC parser throws a CSSException.

      The NSAC parser does not throw a CSSException if there is an error handler set (and in this implementation there is always one), although other parsers may.

      Parameters:
      owner - the element owning the inline style.
      exception - the exception describing the problem.
      inlineStyle - the inline style.
    • computedStyleError

      void computedStyleError(CSSElement element, String propertyName, CSSPropertyValueException exception)
      Error found in computed style declaration.

      This means that an error could only be found when processing the values for computing the style.

      Parameters:
      element - the element for which the style was computed.
      propertyName - the name of the property involved in error.
      exception - the exception describing the error.
    • computedStyleWarning

      void computedStyleWarning(CSSElement element, String propertyName, CSSPropertyValueException exception)
      Error found in computed style declaration.

      This means that an error could only be found when processing the values for computing the style.

      Parameters:
      element - the element for which the style was computed.
      propertyName - the property name.
      exception - the exception describing the error.
    • presentationalHintError

      void presentationalHintError(CSSElement element, DOMException exception)
      While computing a style, an error was found when processing the presentational hints of an element.
      Parameters:
      element - the element.
      exception - the exception describing the error found.
    • resetComputedStyleErrors

      void resetComputedStyleErrors(CSSElement element)
      Reset the error state about computed styles and presentational hints for the given element.
      Parameters:
      element - the element.
    • resetComputedStyleErrors

      void resetComputedStyleErrors()
      Reset the error state about computed styles and presentational hints.
    • reset

      void reset()
      Reset the error handler.

      After calling this method, hasErrors() and hasWarnings() must return false;