platform_error.c

Go to the documentation of this file.
00001 // Except as noted, this file is:
00002 //
00003 // Copyright 2008 Helsinki Institute for Information Technology (HIIT)
00004 // and the authors. All rights reserved.
00005 //
00006 // Authors: Tero Hasu <tero.hasu@hut.fi>
00007 //
00008 // Licensed under the Apache License, Version 2.0 (the "License").
00009 
00010 /*
00011 * ====================================================================
00012 * The symbian_error_strerror function is extracted and modified
00013 * from symbian_python_ext_util.cpp
00014 *  
00015 *                Utilities for Symbian OS specific Python extensions.
00016 * 
00017 * The original code is:
00018 *     
00019 * Copyright (c) 2005 Nokia Corporation
00020 *
00021 * Licensed under the Apache License, Version 2.0 (the "License");
00022 * you may not use this file except in compliance with the License.
00023 * You may obtain a copy of the License at
00024 *
00025 *     http://www.apache.org/licenses/LICENSE-2.0
00026 *
00027 * Unless required by applicable law or agreed to in writing, software
00028 * distributed under the License is distributed on an "AS IS" BASIS,
00029 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00030 * See the License for the specific language governing permissions and
00031 * limitations under the License.
00032 * ====================================================================
00033 */
00034 
00035 #include "common/platform_error.h"
00036 
00037 #include "common/assertions.h"
00038 #include "common/error_list.h"
00039 #include "common/gxerror.h"
00040 
00041 EXTERN_C gboolean code_means_no_error(int errCode, const char* desc, GError** error)
00042 {
00043   assert_error_unset(error);
00044   if (!errCode)
00045     return TRUE;
00046   if (error)
00047     *error = gx_error_new(domain_shared, code_unspecified_error, "%s: %s (%d)", desc, plat_error_strerror(errCode), errCode);
00048   return FALSE;
00049 }
00050 
00051 #ifdef __EPOC32__
00052 
00053 // Provides textual descriptions for Symbian-specific error codes.
00054 EXTERN_C const char* symbian_error_strerror(int err)
00055 {
00056   switch(err) {
00057   case 0:
00058     return "KErrNone";
00059     break;
00060   case (-1):
00061     return "KErrNotFound";
00062     break;
00063   case (-2):
00064     return "KErrGeneral";
00065     break;
00066   case (-3):
00067     return "KErrCancel";
00068     break;
00069   case (-4):
00070     return "KErrNoMemory";
00071     break;
00072   case (-5):
00073     return "KErrNotSupported";
00074     break;
00075   case (-6):
00076     return "KErrArgument";
00077     break;
00078   case (-7):
00079     return "KErrTotalLossOfPrecision";
00080     break;
00081   case (-8):
00082     return "KErrBadHandle";
00083     break;
00084   case (-9):
00085     return "KErrOverflow";
00086     break;
00087   case (-10):
00088     return "KErrUnderflow";
00089     break;
00090   case (-11):
00091     return "KErrAlreadyExists";
00092     break;
00093   case (-12):
00094     return "KErrPathNotFound";
00095     break;
00096   case (-13):
00097     return "KErrDied";
00098     break;
00099   case (-14):
00100     return "KErrInUse";
00101     break;
00102   case (-15):
00103     return "KErrServerTerminated";
00104     break;
00105   case (-16):
00106     return "KErrServerBusy";
00107     break;
00108   case (-17):
00109     return "KErrCompletion";
00110     break;
00111   case (-18):
00112     return "KErrNotReady";
00113     break;
00114   case (-19):
00115     return "KErrUnknown";
00116     break;
00117   case (-20):
00118     return "KErrCorrupt";
00119     break;
00120   case (-21):
00121     return "KErrAccessDenied";
00122     break;
00123   case (-22):
00124     return "KErrLocked";
00125     break;
00126   case (-23):
00127     return "KErrWrite";
00128     break;
00129   case (-24):
00130     return "KErrDisMounted";
00131     break;
00132   case (-25):
00133     return "KErrEof";
00134     break;
00135   case (-26):
00136     return "KErrDiskFull";
00137     break;
00138   case (-27):
00139     return "KErrBadDriver";
00140     break;
00141   case (-28):
00142     return "KErrBadName";
00143     break;
00144   case (-29):
00145     return "KErrCommsLineFail";
00146     break;
00147   case (-30):
00148     return "KErrCommsFrame";
00149     break;
00150   case (-31):
00151     return "KErrCommsOverrun";
00152     break;
00153   case (-32):
00154     return "KErrCommsParity";
00155     break;
00156   case (-33):
00157     return "KErrTimedOut";
00158     break;
00159   case (-34):
00160     return "KErrCouldNotConnect";
00161     break;
00162   case (-35):
00163     return "KErrCouldNotDisconnect";
00164     break;
00165   case (-36):
00166     return "KErrDisconnected";
00167     break;
00168   case (-37):
00169     return "KErrBadLibraryEntryPoint";
00170     break;
00171   case (-38):
00172     return "KErrBadDescriptor";
00173     break;
00174   case (-39):
00175     return "KErrAbort";
00176     break;
00177   case (-40):
00178     return "KErrTooBig";
00179     break;
00180   case (-41):
00181     return "KErrDivideByZero";
00182     break;
00183   case (-42):
00184     return "KErrBadPower";
00185     break;
00186   case (-43):
00187     return "KErrDirFull";
00188     break;
00189   case (-44):
00190     return "KErrHardwareNotAvailable";
00191     break;
00192   case (-45):
00193     return "KErrSessionClosed";
00194     break;
00195   case (-46):
00196     return "KErrPermissionDenied";
00197     break;
00198   default:
00199     return "(error description unavailable)";
00200     break;
00201   }
00202 }
00203 
00204 #endif // __EPOC32__

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