summaryrefslogtreecommitdiffstats
path: root/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs')
-rw-r--r--samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs b/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
index f4f34de..8ca4539 100644
--- a/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
+++ b/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
@@ -18,14 +18,18 @@ public class DatabaseTokenManager : IServiceProviderTokenManager {
var consumerRow = Global.DataContext.OAuthConsumers.SingleOrDefault(
consumerCandidate => consumerCandidate.ConsumerKey == consumerKey);
if (consumerRow == null) {
- throw new ArgumentException();
+ throw new KeyNotFoundException();
}
return consumerRow;
}
public IServiceProviderRequestToken GetRequestToken(string token) {
- return Global.DataContext.OAuthTokens.First(t => t.Token == token);
+ try {
+ return Global.DataContext.OAuthTokens.First(t => t.Token == token);
+ } catch (InvalidOperationException ex) {
+ throw new KeyNotFoundException("Unrecognized token", ex);
+ }
}
#endregion