Ignore:
Timestamp:
12/27/12 08:04:59 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The exception strings are converted from UTF-8 to unicode for proper logging (re #170)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/update.py

    r298 r401  
    11
    22from config import Config
     3from util import utf2unicode
    34
    45import os
     
    206207            manifest.readFrom(f)
    207208    except Exception, e:
    208         print "Error reading the manifest, ignoring:", str(e)
     209        print "Error reading the manifest, ignoring:", utf2unicode(str(e))
    209210        manifest = Manifest()
    210211
     
    228229
    229230    except Exception, e:
    230         print >> sys.stderr, "Error downloading manifest:", str(e)
    231         listener.failed(str(e))
     231        error = utf2unicode(str(e))
     232        print >> sys.stderr, "Error downloading manifest:", error
     233        listener.failed(error)
    232234        return None
    233235    finally:
     
    291293            os.rename(path, os.path.join(toremoveDir, sum.hexdigest()))
    292294        except Exception, e:
    293             print "Cannot remove file " + path + ": " + str(e)   
     295            print "Cannot remove file " + path + ": " + utf2unicode(str(e))
    294296
    295297#------------------------------------------------------------------------------
     
    370372        listener.done()
    371373    except Exception, e:
    372         print >> sys.stderr, "Error:", str(e)
    373         listener.failed(str(e))       
     374        error = utf2unicode(str(e))
     375        print >> sys.stderr, "Error:", error
     376        listener.failed(error)
    374377
    375378#------------------------------------------------------------------------------
     
    432435        except Exception, e:
    433436            print >> sys.stderr, "Failed to parse line '%s': %s" % \
    434                   (line, str(e))               
     437                  (line, utf2unicode(str(e)))
    435438
    436439    return buffer
     
    488491       
    489492    except Exception, e:
    490         print >> sys.stderr, "Failed updating:", str(e)
    491         listener.failed(str(e))
     493        error = utf2unicode(str(e))
     494        print >> sys.stderr, "Failed updating:", error
     495        listener.failed(error)
    492496    finally:
    493497        if serverSocket is not None:
Note: See TracChangeset for help on using the changeset viewer.