epoc-ao-gerror.cpp

Go to the documentation of this file.
00001 #include "epoc-ao-gerror.hpp"
00002 
00003 #include "ac_app_context.h"
00004 #include "er_errors.h"
00005 
00006 #include "common/assertions.h"
00007 #include "common/error_list.h"
00008 #include "common/platform_error.h"
00009 #include "common/logging.h"
00010 
00011 #if __IS_APPLICATION__
00012 #include <aknappui.h>
00013 #include <stdlib.h> // exit(3)
00014 #endif
00015 
00016 // -----------------------------------------------------------------------------
00017 // active object...
00018 
00019 TInt CActiveLogErr::RunError(TInt errCode)
00020 {
00021   log_db_log_status(ac_global_LogDb, NULL, "FATAL: error in the RunL of %s", Description());
00022   ex_dblog_fatal_error(ac_global_LogDb, errCode);
00023   return 0;
00024 }
00025 
00026 // -----------------------------------------------------------------------------
00027 // active object...
00028 
00029 CActiveLogErrG::~CActiveLogErrG()
00030 {
00031   //logt("~CActiveLogErrG() enter");
00032   //logg("iError is %d", (int)iError);
00033   gx_error_free(iError);
00034   //logt("~CActiveLogErrG() exit");
00035 }
00036 
00037 TInt CActiveLogErrG::RunError(TInt aError)
00038 {
00039   if (aError != KGError) { // Symbian error code
00040     return CActiveLogErr::RunError(aError);
00041   } else { // GError object
00042     log_db_log_status(ac_global_LogDb, NULL, "FATAL: error in the RunL of %s", Description());
00043     gx_dblog_fatal_error_clear(ac_global_LogDb, &iError);
00044     return 0;
00045   }
00046 }
00047 
00048 // This is to be called within a 'RunL' method.
00049 // Takes ownership of 'aError'.
00050 void CActiveLogErrG::Leave(GError* aError)
00051 {
00052   gx_error_free(iError);
00053   iError = aError;
00054   User::Leave(KGError);
00055 }
00056 
00057 // -----------------------------------------------------------------------------
00058 // active object...
00059 
00060 void CActiveRunG::RunL()
00061 {
00062   // Whether or not any previously set error has been processed, we
00063   // may need to set a new error value in it now. The active scheduler
00064   // has had a chance to run and process any previous error, so it is
00065   // quite okay to do this.
00066   GError** error = &iError;
00067   g_clear_error(error);
00068   assert(iError == NULL);
00069 
00070   if (!RunGL(error))
00071     User::Leave(KGError);
00072 }
00073 
00074 /**
00075 
00076 epoc-ao-gerror.cpp
00077 
00078 Copyright 2009 Helsinki Institute for Information Technology (HIIT)
00079 and the authors. All rights reserved.
00080 
00081 Authors: Tero Hasu <tero.hasu@hut.fi>
00082 
00083 Permission is hereby granted, free of charge, to any person
00084 obtaining a copy of this software and associated documentation files
00085 (the "Software"), to deal in the Software without restriction,
00086 including without limitation the rights to use, copy, modify, merge,
00087 publish, distribute, sublicense, and/or sell copies of the Software,
00088 and to permit persons to whom the Software is furnished to do so,
00089 subject to the following conditions:
00090 
00091 The above copyright notice and this permission notice shall be
00092 included in all copies or substantial portions of the Software.
00093 
00094 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00095 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00096 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00097 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00098 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00099 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00100 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00101 SOFTWARE.
00102 
00103  **/

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:52 2011 by Doxygen 1.6.1