OpenGamma / ElSql

Manage external SQL files in Java with a little DSL goodness
Other
101 stars 26 forks source link

Throw an exception when none of the specified resources exists, when parsing #17

Closed evpaassen closed 9 years ago

evpaassen commented 9 years ago

Fixes #16.

Looking at the demo code from #16 again:

import com.opengamma.elsql.ElSql;
import com.opengamma.elsql.ElSqlConfig;

public class Test {

    public static void main(String[] args) {
        ElSql bundle = ElSql.of(ElSqlConfig.DEFAULT, Test.class);
        bundle.getSql("test");
    }
}

This produces an exception on the ElSql.of(...) call already:

Exception in thread "main" java.lang.IllegalArgumentException: No matching resource was found
    at com.opengamma.elsql.SqlFragments.parseResource(SqlFragments.java:53)
    at com.opengamma.elsql.ElSql.parse(ElSql.java:89)
    at com.opengamma.elsql.ElSql.of(ElSql.java:60)
    at Test.main(Test.java:7)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Process finished with exit code 1
jodastephen commented 9 years ago

Thanks for the enhancement