[SecureElement] Log refactoring.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 27 Nov 2015 14:01:14 +0000 (15:01 +0100)
committerHyunJin Park <hj.na.park@samsung.com>
Thu, 3 Dec 2015 00:28:51 +0000 (09:28 +0900)
[Verification] Not tested, module disabled.

Change-Id: I713402f563dc7665ca87a17433541ec5e89f1f12
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/secureelement/secureelement_instance.cc
src/secureelement/secureelement_seservice.cc

index e486668f3bf2c693b44142469c55a90b4eae13bb..6b3f537defe873d46bd41e2996c94b482c52aa5b 100644 (file)
@@ -165,20 +165,15 @@ void SecureElementInstance::OpenSession(
             picojson::value result = seReader.openSession();
             ReportSuccess(result, response->get<picojson::object>());
         } catch (const ErrorIO& err) {
-            LoggerD("Library reported ErrorIO!");
-            ReportError(PlatformResult(ErrorCode::IO_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::IO_ERR), &response->get<picojson::object>());
         } catch (const ErrorIllegalState& err) {
-            LoggerD("Library reported ErrorIllegalState!");
-            ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR), &response->get<picojson::object>());
         } catch (const ErrorIllegalParameter& err) {
-            LoggerD("Library reported ErrorIllegalParameter!");
-            ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR), &response->get<picojson::object>());
         } catch (const ErrorSecurity& err) {
-            LoggerD("Library reported ErrorSecurity!");
-            ReportError(PlatformResult(ErrorCode::SECURITY_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::SECURITY_ERR), &response->get<picojson::object>());
         } catch (const ExceptionBase& err) {
-            LoggerD("Library reported ExceptionBase!");
-            ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR), &response->get<picojson::object>());
         }
     };
 
@@ -213,20 +208,15 @@ void SecureElementInstance::OpenBasicChannel( const picojson::value& args, picoj
             picojson::value result = seSession.openBasicChannel(v_aid);
             ReportSuccess(result, response->get<picojson::object>());
         } catch (const ErrorIO& err) {
-            LoggerD("Library reported ErrorIO!");
-            ReportError(PlatformResult(ErrorCode::IO_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::IO_ERR), &response->get<picojson::object>());
         } catch (const ErrorIllegalState& err) {
-            LoggerD("Library reported ErrorIllegalState!");
-            ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR), &response->get<picojson::object>());
         } catch (const ErrorIllegalParameter& err) {
-            LoggerD("Library reported ErrorIllegalParameter!");
-            ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR), &response->get<picojson::object>());
         } catch (const ErrorSecurity& err) {
-            LoggerD("Library reported ErrorSecurity!");
-            ReportError(PlatformResult(ErrorCode::SECURITY_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::SECURITY_ERR), &response->get<picojson::object>());
         } catch (const ExceptionBase& err) {
-            LoggerD("Library reported ExceptionBase!");
-            ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR), &response->get<picojson::object>());
         }
     };
 
@@ -256,20 +246,15 @@ void SecureElementInstance::OpenLogicalChannel( const picojson::value& args, pic
             picojson::value result = seSession.openLogicalChannel(v_aid);
             ReportSuccess(result, response->get<picojson::object>());
         } catch (const ErrorIO& err) {
-            LoggerD("Library reported ErrorIO!");
-            ReportError(PlatformResult(ErrorCode::IO_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::IO_ERR), &response->get<picojson::object>());
         } catch (const ErrorIllegalState& err) {
-            LoggerD("Library reported ErrorIllegalState!");
-            ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR), &response->get<picojson::object>());
         } catch (const ErrorIllegalParameter& err) {
-            LoggerD("Library reported ErrorIllegalParameter!");
-            ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR), &response->get<picojson::object>());
         } catch (const ErrorSecurity& err) {
-            LoggerD("Library reported ErrorSecurity!");
-            ReportError(PlatformResult(ErrorCode::SECURITY_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::SECURITY_ERR), &response->get<picojson::object>());
         } catch (const ExceptionBase& err) {
-            LoggerD("Library reported ExceptionBase!");
-            ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR), &response->get<picojson::object>());
         }
     };
 
@@ -348,20 +333,15 @@ void SecureElementInstance::Transmit( const picojson::value& args, picojson::obj
             }
             ReportSuccess( result, response->get<picojson::object>());
         } catch (const ErrorIO& err) {
-            LoggerD("Library reported ErrorIO!");
-            ReportError(PlatformResult(ErrorCode::IO_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::IO_ERR), &response->get<picojson::object>());
         } catch (const ErrorIllegalState& err) {
-            LoggerD("Library reported ErrorIllegalState!");
-            ReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR), &response->get<picojson::object>());
         } catch (const ErrorIllegalParameter& err) {
-            LoggerD("Library reported ErrorIllegalParameter!");
-            ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR), &response->get<picojson::object>());
         } catch (const ErrorSecurity& err) {
-            LoggerD("Library reported ErrorSecurity!");
-            ReportError(PlatformResult(ErrorCode::SECURITY_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::SECURITY_ERR), &response->get<picojson::object>());
         } catch (const ExceptionBase& err) {
-            LoggerD("Library reported ExceptionBase!");
-            ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR), &response->get<picojson::object>());
+            LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR), &response->get<picojson::object>());
         }
     };
 
index 27bf86ae021b072b38c55ce6760a816c9545569f..15fe491824d2d72080f7f4793cbd356eb009ea50 100644 (file)
@@ -116,12 +116,12 @@ void SEService::GetReaders(double callback_id) {
 
   if (is_error_) {
     // there has been an error, report it asynchronously
-    LoggerE("Failed: is_error_");
     std::shared_ptr<picojson::value> response{new picojson::value{picojson::object{}}};
-    ReportError(
+    LogAndReportError(
         PlatformResult(ErrorCode::SERVICE_NOT_AVAILABLE_ERR,
                        "Unable to connect to service."),
-        &response->get<picojson::object>());
+        &response->get<picojson::object>(),
+        ("Failed: is_error_"));
     TaskQueue::GetInstance().Async<picojson::value>(get_readers_response, response);
     return;
   }