Could not throw exception

I am using SVNKit and the only way to check the authentication on the server is with a testConnection()

class method SVNRepository

.

The method does not return a boolean value, but it throws an exception.

public abstract void testConnection()
                         throws SVNException

      

The problem is that instead of catching, I get coldfusion error: coldfusion error in try catch (SVNRepository.testConnection ())

Here is my code:

        clientManager = CreateObject("java", "org.tmatesoft.svn.core.wc.SVNClientManager").newInstance();

        authManagerJO = CreateObject("java", "org.tmatesoft.svn.core.wc.SVNWCUtil").
                createDefaultAuthenticationManager(ARGUMENTS.username, JavaCast("String", ARGUMENTS.password));
        authManagerJO.setAuthenticationForced(true);
        clientManager.setAuthenticationManager(authManagerJO); 
        svnDavRepoFactory = CreateObject("java", "org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory").setup();
        repositoryUrlJO = CreateObject("java", "org.tmatesoft.svn.core.SVNURL").parseURIDecoded(APPLICATION.svn_repository_audifiles);
        svnRepository = clientManager.createRepository(repositoryUrlJO, true);
        try{
            svnRepository.testConnection();
        }
        catch (Exception e){
            svnRepository = "";
        }

      

+3


source to share


3 answers


Have you tried to catch Any

instead Exception

?



That way, you are sure to catch everything, even if the exception is not Exception

as John suggested.

+2


source


Well, it is entirely possible that it is throwing an exception that is not Exception

- another type Throwable

. You could catch Throwable

, although that would be pretty harsh ... catching it once by throwing the exact type of exception and then catching that would be smart though ...



+7


source


Do

catch (any e) {
    write dump(e);
    abort;
}

      

Then you will see the actual error.

0


source







All Articles