specific exception for connection problems
This commit is contained in:
1 parent
3f4189607c
commit
8ceebf2ded
3 files changed
+18
-7
No files matched your search
@@ -0,0 +1,14 @@
|
||||
package org.scribe.exceptions;
|
||||
|
||||
/**
|
||||
* @author: Pablo Fernandez
|
||||
*/
|
||||
public class OAuthConnectionException extends OAuthException
|
||||
{
|
||||
private static final String MSG = "There was a problem while creating a connection to the remote service.";
|
||||
|
||||
public OAuthConnectionException(Exception e)
|
||||
{
|
||||
super(MSG, e);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ package org.scribe.exceptions;
|
||||
public class OAuthSignatureException extends OAuthException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String MSG = "Error while signing string: %s";
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
@@ -17,7 +18,7 @@ public class OAuthSignatureException extends OAuthException
|
||||
*/
|
||||
public OAuthSignatureException(String stringToSign, Exception e)
|
||||
{
|
||||
super("Error while signing string: " + stringToSign, e);
|
||||
super(String.format(MSG, stringToSign), e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,13 +61,9 @@ class Request
|
||||
createConnection();
|
||||
return doSend();
|
||||
}
|
||||
catch (UnknownHostException uhe)
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new OAuthException("Could not reach the desired host. Check your network connection.", uhe);
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
throw new OAuthException("Problems while creating connection.", ioe);
|
||||
throw new OAuthConnectionException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user