Browse files

add the error code to the GsaslError

  • Loading branch information...
1 parent ab00522 commit cfc64200e73c6c8f3db6a7920303c281decae4d7 Vincent Landgraf committed May 3, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/gsasl/native.rb
View
10 lib/gsasl/native.rb
@@ -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

0 comments on commit cfc6420

Please sign in to comment.