lightmelody

changeset 745:a5cf28dbe400

Added error raising for open/not open connections
author Arc Riley <arcriley@gmail.com>
date Fri, 05 Jun 2015 06:31:55 -0400
parents 139cf216a934
children 0608d319c258
files src/Connection.gs
diffstat 1 files changed, 7 insertions(+), 21 deletions(-) [+]
line diff
     1.1 --- a/src/Connection.gs	Thu Jan 01 00:00:00 2015 +0000
     1.2 +++ b/src/Connection.gs	Fri Jun 05 06:31:55 2015 -0400
     1.3 @@ -201,13 +201,7 @@
     1.4          domain : string
     1.5  
     1.6          if !self.is_open()
     1.7 -            /* TODO
     1.8 -            g_set_error (error,
     1.9 -                         LM_ERROR,
    1.10 -                         LM_ERROR_CONNECTION_NOT_OPEN,
    1.11 -                         "Connection is not open, call lm_connection_open() first");
    1.12 -            */
    1.13 -            return false
    1.14 +            raise new Lm.Error.CONNECTION_NOT_OPEN("Connection is not open.")
    1.15  
    1.16          state = State.AUTHENTICATING
    1.17  
    1.18 @@ -263,15 +257,13 @@
    1.19  
    1.20      // DEPRECATED
    1.21      def open (function : ResultFunction#) : bool raises Error
    1.22 +        // This implement loudmouth's async connection open which
    1.23 +        // differs from glib/gio's async api. All new code should use
    1.24 +        // open_async instead.
    1.25 +
    1.26          // Bail if the connection is already open
    1.27          if is_open()
    1.28 -            /*
    1.29 -            set_error (error,
    1.30 -                       Lm.Error,
    1.31 -                       Lm.Error.CONNECTION_NOT_OPEN,
    1.32 -                       "Connection already open.")
    1.33 -            */
    1.34 -            return false
    1.35 +            raise new Lm.Error.CONNECTION_OPEN("Connection already open.")
    1.36  
    1.37          state = State.OPENING
    1.38  
    1.39 @@ -290,13 +282,7 @@
    1.40      def async open_async () : bool raises Error
    1.41          // Bail if the connection is already open
    1.42          if is_open()
    1.43 -            /*
    1.44 -            set_error (error,
    1.45 -                       Lm.Error,
    1.46 -                       Lm.Error.CONNECTION_NOT_OPEN,
    1.47 -                       "Connection already open.")
    1.48 -            */
    1.49 -            return false
    1.50 +            raise new Lm.Error.CONNECTION_OPEN("Connection already open.")
    1.51  
    1.52          state = State.OPENING
    1.53