[Groonga-commit] groonga/grnxx at bd541c6 [master] Add error handling.

Back to archive index

susumu.yata null+****@clear*****
Tue Jul 2 15:16:28 JST 2013


susumu.yata	2013-07-02 15:16:28 +0900 (Tue, 02 Jul 2013)

  New Revision: bd541c651afac321fdae591e5ad0b78b809806a7
  https://github.com/groonga/grnxx/commit/bd541c651afac321fdae591e5ad0b78b809806a7

  Message:
    Add error handling.

  Modified files:
    lib/grnxx/charset.cpp

  Modified: lib/grnxx/charset.cpp (+5 -4)
===================================================================
--- lib/grnxx/charset.cpp    2013-07-02 14:43:39 +0900 (98ea777)
+++ lib/grnxx/charset.cpp    2013-07-02 15:16:28 +0900 (f7653be)
@@ -20,6 +20,8 @@
 #include "grnxx/charset/euc-jp.hpp"
 #include "grnxx/charset/shift_jis.hpp"
 #include "grnxx/charset/utf-8.hpp"
+#include "grnxx/exception.hpp"
+#include "grnxx/logger.hpp"
 #include "grnxx/string_builder.hpp"
 
 namespace grnxx {
@@ -56,12 +58,11 @@ const Charset *Charset::get(CharsetCode code) {
     case CHARSET_UTF_8: {
       return charset::UTF_8::get();
     }
-    case CHARSET_UNKNOWN: {
-      break;
+    default: {
+      GRNXX_ERROR() << "invalid argument: code = " << code;
+      throw LogicError();
     }
   }
-  // TODO: Error handling.
-  return nullptr;
 }
 
 }  // namespace grnxx
-------------- next part --------------
HTML����������������������������...
Download 



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