Skip to content

Commit

Permalink
add the error code to the GsaslError
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Landgraf committed May 3, 2012
1 parent ab00522 commit cfc6420
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/gsasl/native.rb
Expand Up @@ -137,11 +137,13 @@ module Gsasl
attach_function :gsasl_step64, [ :pointer, :string, :pointer], :int

# Raises an error if the passed result is not GSASL_OK
# @param [Fixnum] result that should be checked
# @param [Fixnum] code that should be checked
# @raises [GsaslError] if a different result occured
def self.raise_error!(result)
if result != GSASL_OK
raise GsaslError, Gsasl.gsasl_strerror(result)
def self.raise_error!(code)
if code != GSASL_OK
error = GsaslError.new(Gsasl.gsasl_strerror(code) + " [#{code}]")
error.code = code
raise error
end
end

Expand Down

0 comments on commit cfc6420

Please sign in to comment.