Class AssetErrorReporter

java.lang.Object
org.openpatch.scratch.internal.AssetErrorReporter

public final class AssetErrorReporter extends Object
Utility class that builds beginner-friendly error messages when an asset file cannot be loaded. It shows the resolved absolute path, checks whether the parent folder exists, and lists nearby files to help spot typos.
  • Method Details

    • reportAndFail

      public static void reportAndFail(String assetType, String originalPath, String supportedFormats, String[] fileExtensions)
      Prints a detailed, beginner-friendly error for a failed asset load and then fails.
      Parameters:
      assetType - Human-readable type, e.g. "image", "sound", "font"
      originalPath - The path string the user supplied
      supportedFormats - Short list of accepted extensions, e.g. "PNG, JPG, GIF"
      fileExtensions - Extensions used to filter similar files in the same dir, e.g. new String[]{".png",".jpg",".gif"}
    • reportUnknownBuiltinAndFail

      public static void reportUnknownBuiltinAndFail(String name, String assetType)
      Prints a beginner-friendly error for a name that was meant to be an asset bundled with Scratch for Java but does not exist, and then fails.
      Parameters:
      name - the name the user supplied
      assetType - either "sprite" or "sound"