[Groonga-commit] ranguba/groonga-client at cbb8383 [master] Response::Error: add #function, #file and #line

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Jul 13 16:07:44 JST 2018


Kouhei Sutou	2018-07-13 16:07:44 +0900 (Fri, 13 Jul 2018)

  New Revision: cbb8383dc92dcabcddde640da5b313b863c444f5
  https://github.com/ranguba/groonga-client/commit/cbb8383dc92dcabcddde640da5b313b863c444f5

  Message:
    Response::Error: add #function, #file and #line

  Modified files:
    lib/groonga/client/response/error.rb

  Modified: lib/groonga/client/response/error.rb (+42 -2)
===================================================================
--- lib/groonga/client/response/error.rb    2018-02-16 17:21:14 +0900 (800b4c0)
+++ lib/groonga/client/response/error.rb    2018-07-13 16:07:44 +0900 (731c347)
@@ -20,10 +20,50 @@ module Groonga
   class Client
     module Response
       class Error < Base
-        # @return [String] The error message of the error response.
+        # @return [String, nil] The error message of the error response.
+        #
         # @since 0.1.0
         def message
-          (header || [0, 0, 0.0, ""])[3]
+          error_message
+        end
+
+        # @return [String, nil] The function name where the error is occurred.
+        #
+        # @since 0.5.9
+        def function
+          if header.nil?
+            nil
+          elsif header_v1?
+            header[4]
+          else
+            (header["error"] || {})["function"]
+          end
+        end
+
+        # @return [String, nil] The file name where the error is occurred.
+        #
+        # @since 0.5.9
+        def file
+          if header.nil?
+            nil
+          elsif header_v1?
+            header[5]
+          else
+            (header["error"] || {})["file"]
+          end
+        end
+
+        # @return [String, nil] The line where the error is occurred.
+        #
+        # @since 0.5.9
+        def line
+          if header.nil?
+            nil
+          elsif header_v1?
+            header[5]
+          else
+            (header["error"] || {})["line"]
+          end
         end
       end
     end
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180713/9d7f16e7/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index