[mono/monodevelop] 61a37dfc: [MacPlatform] Instead of throwing exceptions on unknown keychain errors, just return null

"Jeffrey Stedfast ([email protected])" <[email protected]> Thu, 7 Nov 2013 22:14:32 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014234a1906e-94e11aaf-3b5d-4b0c-a3c6-0bd5e880026a-000000@email.amazonses.com>
   Branch: refs/heads/license-sync
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/254a4fbdbaa9...61a37dfca6b4

   Commit: 61a37dfca6b490205ba86e679fa55b13084d2f78
   Author: Jeffrey Stedfast <[email protected]> (jstedfast)
     Date: 2013-11-07 22:12:47 GMT
      URL: https://github.com/mono/monodevelop/commit/61a37dfca6b490205ba86e679fa55b13084d2f78

[MacPlatform] Instead of throwing exceptions on unknown keychain errors, just return null

Fixes bug #16017

Changed paths:
  M main/src/addins/MacPlatform/MacInterop/Keychain.cs

Modified: main/src/addins/MacPlatform/MacInterop/Keychain.cs
===================================================================
@@ -821,11 +821,8 @@ static unsafe string GetUsernameFromKeychainItemRef (IntPtr itemRef)
 			                                              0, null, (uint) path.Length, path, (ushort) uri.Port,
 			                                              protocol, auth, out passwordLength, out passwordData, ref item);
 
-			if (result == OSStatus.ItemNotFound)
-				return null;
-
 			if (result != OSStatus.Ok)
-				throw new Exception ("Could not find internet username and password: " + GetError (result));
+				return null;
 
 			var username = GetUsernameFromKeychainItemRef (item);
 
@@ -857,11 +854,8 @@ public static string FindInternetPassword (Uri uri)
 
 			CFRelease (item);
 
-			if (result == OSStatus.ItemNotFound)
-				return null;
-
 			if (result != OSStatus.Ok)
-				throw new Exception ("Could not find internet password: " + GetError (result));
+				return null;
 
 			return Marshal.PtrToStringAuto (passwordData, (int) passwordLength);
 		}


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches