Package org.openpatch.scratch.internal
Class AssetErrorReporter
java.lang.Object
org.openpatch.scratch.internal.AssetErrorReporter
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 Summary
Modifier and TypeMethodDescriptionstatic voidreportAndFail(String assetType, String originalPath, String supportedFormats, String[] fileExtensions) Prints a detailed, beginner-friendly error for a failed asset load and then fails.static voidreportUnknownBuiltinAndFail(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.
-
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 suppliedsupportedFormats- 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
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 suppliedassetType- either "sprite" or "sound"
-