[pypy-svn] r33222 - pypy/dist/pypy/translator/cli/src

antocuni at codespeak.net antocuni at codespeak.net
Thu Oct 12 12:44:57 CEST 2006


Author: antocuni
Date: Thu Oct 12 12:44:56 2006
New Revision: 33222

Modified:
   pypy/dist/pypy/translator/cli/src/ll_os.cs
Log:
Handle KeyErrorException instead of checking null.



Modified: pypy/dist/pypy/translator/cli/src/ll_os.cs
==============================================================================
--- pypy/dist/pypy/translator/cli/src/ll_os.cs	(original)
+++ pypy/dist/pypy/translator/cli/src/ll_os.cs	Thu Oct 12 12:44:56 2006
@@ -187,13 +187,14 @@
 
         public static string ll_os_strerror(int errno)
         {
-            string msg = ErrorMessages[errno];
-            if (msg != null) {
+            try {
+                string msg = ErrorMessages[errno];
                 ErrorMessages.Remove(errno);
                 return msg;
             }
-            else
+            catch(KeyNotFoundException e) {
                 return "error " + errno;
+            }
         }
 
         public static string ll_os_getcwd()



More information about the Pypy-commit mailing list