Skip to content

Improved error messages on executing .abs #10

@zaerald

Description

@zaerald

Add more descriptive messages instead of a stack trace.

When running an abs that doesn't exist.
Suggesting around "The file you specified cannot be executed. Please check the file name."

$ java -Djava.library.path=../native -jar AnyaBasic-latest.jar doesnotexists.abs
Exception in thread "main" java.lang.NullPointerException
        at net.phatcode.rel.main.SourceReader.read(SourceReader.java:59)
        at net.phatcode.rel.main.SourceReader.<init>(SourceReader.java:48)
        at net.phatcode.rel.main.Interpreter.run(Interpreter.java:88)
        at net.phatcode.rel.main.AnyaBasicMain.main(AnyaBasicMain.java:56)

When running non abs file should avoid it from opening it.
non-.abs files
"Only AnyaBasic (.abs) files are valid to be executed."

$ java -Djava.library.path=../native -jar AnyaBasic-latest.jar document.pdf
Exception in thread "main" java.lang.NullPointerException
        at net.phatcode.rel.main.SourceReader.read(SourceReader.java:59)
        at net.phatcode.rel.main.SourceReader.<init>(SourceReader.java:48)
        at net.phatcode.rel.main.Interpreter.run(Interpreter.java:88)
        at net.phatcode.rel.main.AnyaBasicMain.main(AnyaBasicMain.java:56)

no extension files are still arguably, as we need to check if it is a valid abs file and throw an error message.

$ java -Djava.library.path=../native -jar AnyaBasic-latest.jar noextension
Exception in thread "main" java.lang.NullPointerException
        at net.phatcode.rel.main.SourceReader.read(SourceReader.java:59)
        at net.phatcode.rel.main.SourceReader.<init>(SourceReader.java:48)
        at net.phatcode.rel.main.Interpreter.run(Interpreter.java:88)
        at net.phatcode.rel.main.AnyaBasicMain.main(AnyaBasicMain.java:56)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions