Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

OSCL Error


Files

file  oscl_errno.h
 Defines functions to access additional information on errors where supported through an errno or similar service.

file  oscl_error.h
 OSCL Error trap and cleanup include file.

file  oscl_error_allocator.h
 Defines a memory allocation class used by the oscl error layer.

file  oscl_error_codes.h
 Defines basic error and leave codes.

file  oscl_error_imp.h
 Internal error implementation support.

file  oscl_error_imp_cppexceptions.h
 Implementation File for Leave using C++ exceptions.

file  oscl_error_imp_fatalerror.h
 Implementation File for Leave using system fatal error.

file  oscl_error_imp_jumps.h
 Implemenation of using Setjmp / Longjmp.

file  oscl_error_trapcleanup.h
 OSCL Error trap and cleanup implementation include file.

file  oscl_exception.h
 contains all the exception handling macros and classes

file  oscl_heapbase.h
 OSCL Heap Base include file.

file  oscl_mempool_allocator.h
 This file contains the definition of memory pool allocator for leave/trap.

file  oscl_namestring.h
 Name string class include file.


Data Structures

class  _OsclHeapBase
class  internalLeave
class  OsclError
class  OsclErrorAllocator
 This class provides static methods to invoke the user defined memory allocation routines. More...

class  OsclErrorTrap
class  OsclErrorTrapImp
class  OsclException
 oscl_exception.h contains all the exception handling macros and classes This template class provides the base exception class that all exceptions derive from More...

class  OsclJump
class  OsclMemPoolAllocator
class  OsclNameString
class  OsclTLSEx
class  OsclTLSRegistryEx
class  OsclTrapItem
class  OsclTrapStack
class  OsclTrapStackItem

Defines

#define OSCL_TRAPSTACK_PUSH(a)   OsclError::PushL(a)
#define OSCL_TRAPSTACK_POP()   OsclError::Pop()
#define OSCL_TRAPSTACK_POPDEALLOC()   OsclError::PopDealloc()
#define OsclErrNone   0
#define OsclErrGeneral   100
#define OsclErrNoMemory   101
#define OsclErrCancelled   102
#define OsclErrNotSupported   103
#define OsclErrArgument   104
#define OsclErrBadHandle   105
#define OsclErrAlreadyExists   106
#define OsclErrBusy   107
#define OsclErrNotReady   108
#define OsclErrCorrupt   109
#define OsclErrTimeout   110
#define OsclErrOverflow   111
#define OsclErrUnderflow   112
#define OsclErrInvalidState   113
#define OsclErrNoResources   114
#define OsclErrNotInstalled   115
#define OsclErrAlreadyInstalled   116
#define OsclErrSystemCallFailed   117
#define OsclErrNoHandler   118
#define OsclErrThreadContextIncorrect   119
#define OSCL_ERR_NONE   OsclErrNone
#define OSCL_BAD_ALLOC_EXCEPTION_CODE   OsclErrNoMemory
#define OsclSuccess   0
#define OsclPending   1
#define OsclFailure   -1
#define PVERROR_IMP_JUMPS
#define PVError_DoLeave()   internalLeave __ilv;__ilv.a=0;throw(__ilv)
#define _PV_TRAP(__r, __s)
#define _PV_TRAP_NO_TLS(__trapimp, __r, __s)
#define OSCL_JUMP_MAX_JUMP_MARKS   OSCL_MAX_TRAP_LEVELS
#define internalLeave   (-1)
#define OSCL_MAX_TRAP_LEVELS   20
#define PVERRORTRAP_REGISTRY_ID   OSCL_TLS_ID_PVERRORTRAP
#define PVERRORTRAP_REGISTRY   OsclTLSRegistry
#define OSCL_LEAVE(_leave_status)   OsclError::Leave(_leave_status)
 Use this macro to cause a Leave. It terminates the execution of the current active function.

#define OSCL_TRY(_leave_status, _statements)   _PV_TRAP(_leave_status,_statements)
 This macro will be used to set up a try block.

#define OSCL_TRY_NO_TLS(__trapimp, _leave_status, _statements)   _PV_TRAP_NO_TLS(__trapimp,_leave_status,_statements)
#define OSCL_FIRST_CATCH_ANY(_leave_status, _statements)   if (_leave_status!=OsclErrNone) { _statements; }
 This section defines the macros to be used in the catch block following the try block Use this macro to call a function that handles all exception types thrown in the preceding try block.

#define OSCL_FIRST_CATCH(_leave_status, _catch_value, _statements)   if (_leave_status!=OsclErrNone && _leave_status == _catch_value){_statements;}
 Use this macro to define a block of code that catches the first exception type thrown in the preceding try block.

#define OSCL_CATCH(_leave_status, _catch_value, _statements)   else if (_leave_status!=OsclErrNone && _leave_status == _catch_value){_statements;}
 Use this macro to define a block of code for catching additional exception types.

#define OSCL_CATCH_ANY(_leave_status, _statements)   else if (_leave_status!=OsclErrNone){ _statements;}
 Use this macro to call a function that will catch all remaining exception types.

#define OSCL_LAST_CATCH(_leave_status)   else if (_leave_status!=OsclErrNone){OSCL_LEAVE(_leave_status);}
 Use this macro if OSCL_CATCH_ANY has not been used. It will mark the end of the catch block.


Typedefs

typedef int32 OsclLeaveCode
typedef int32 OsclReturnCode
typedef void(* OsclTrapOperation )(OsclAny *)

Functions

OSCL_IMPORT_REF bool OSCL_IsErrnoSupported ()
 This function determines if a particular system saves the error number that occurs on a system call.

OSCL_IMPORT_REF int OSCL_GetLastError ()
 This function returns the value of the system's global error number variable.

OSCL_IMPORT_REF bool OSCL_SetLastError (int newVal)
 This function sets the last error code for the system.

OSCL_IMPORT_REF char * OSCL_StrError (int errnum)
 This function maps an error number to an error-message string.


Define Documentation

#define _PV_TRAP __r,
__s   
 

Value:

__r=OsclErrNone;\
        {\
                OsclErrorTrapImp* __tr=OsclErrorTrapImp::Trap();\
                if(!__tr){__s;}else{\
                try{__s;}\
                catch(internalLeave __lv)\
                {__lv.a=__r=__tr->iLeave;}\
                __tr->UnTrap();}\
        }

#define _PV_TRAP_NO_TLS __trapimp,
__r,
__s   
 

Value:

__r=OsclErrNone;\
        {\
                OsclErrorTrapImp* __tr=OsclErrorTrapImp::TrapNoTls(__trapimp);\
                if(!__tr){__s;}else{\
                try{__s;}\
                catch(internalLeave __lv)\
                {__lv.a=__r=__tr->iLeave;}\
                __tr->UnTrap();}\
        }

#define internalLeave   (-1)
 

#define OSCL_BAD_ALLOC_EXCEPTION_CODE   OsclErrNoMemory
 

#define OSCL_CATCH _leave_status,
_catch_value,
_statements       else if (_leave_status!=OsclErrNone && _leave_status == _catch_value){_statements;}
 

Use this macro to define a block of code for catching additional exception types.

OSCL_FIRST_CATCH can be used to catch one exception type. Then the OSCL_CATCH macro can be used to catch each subsequent type. The catch block must end with OSCL_LAST_CATCH or OSCL_CATCH_ANY

Parameters:
oscl_leave_status  is the result of any OSCL_THROW
exceptiontype  is the exception handled by this catch block

#define OSCL_CATCH_ANY _leave_status,
_statements       else if (_leave_status!=OsclErrNone){ _statements;}
 

Use this macro to call a function that will catch all remaining exception types.

Parameters:
_leave_status 
_statements  is a statement or block of statements to handle all remaining exception types. This macro ends the try block.

#define OSCL_ERR_NONE   OsclErrNone
 

For backward compatibility with old definitions

#define OSCL_FIRST_CATCH _leave_status,
_catch_value,
_statements       if (_leave_status!=OsclErrNone && _leave_status == _catch_value){_statements;}
 

Use this macro to define a block of code that catches the first exception type thrown in the preceding try block.

Parameters:
oscl_leave_status  is the leave code that was returned by OSCL_THROW
exceptiontype  is the exception handled by this catch block This macro MUST be used in conjunction with either OSCL_LAST_CATCH or OSCL_CATCH_ANY

#define OSCL_FIRST_CATCH_ANY _leave_status,
_statements       if (_leave_status!=OsclErrNone) { _statements; }
 

This section defines the macros to be used in the catch block following the try block Use this macro to call a function that handles all exception types thrown in the preceding try block.

Parameters:
_leave_status 
_statements  is a statement or block of statements that will catch all the exception types thrown by the preceding try block This is a standalone macro and should not be used with any of the macros above

#define OSCL_JUMP_MAX_JUMP_MARKS   OSCL_MAX_TRAP_LEVELS
 

#define OSCL_LAST_CATCH _leave_status       else if (_leave_status!=OsclErrNone){OSCL_LEAVE(_leave_status);}
 

Use this macro if OSCL_CATCH_ANY has not been used. It will mark the end of the catch block.

Parameters:
_leave_status  will be propagated up the call stack This macro will do an OSCL_LEAVE if the leave has not been handled by the calls above. This macro ends the try block.

#define OSCL_LEAVE _leave_status       OsclError::Leave(_leave_status)
 

Use this macro to cause a Leave. It terminates the execution of the current active function.

It also tries to cleanup the items on the cleanup stack.

Parameters:
oscl_leave_status  tells the cause for the Leave

#define OSCL_MAX_TRAP_LEVELS   20
 

 
#define OSCL_TRAPSTACK_POP      OsclError::Pop()
 

 
#define OSCL_TRAPSTACK_POPDEALLOC      OsclError::PopDealloc()
 

#define OSCL_TRAPSTACK_PUSH      OsclError::PushL(a)
 

Cleanup Stack user macros

#define OSCL_TRY _leave_status,
_statements       _PV_TRAP(_leave_status,_statements)
 

This macro will be used to set up a try block.

The try block identifies a block of code that might throw exceptions (or leave)

Parameters:
oscl_leave_status  oscl_leave_status will receive the result of any OSCL_LEAVE (which will get called from a OSCL_THROW) on systems that do not support exception handling.This is unused on systems that do support exception handling
statements  is a statement or block of statements that could throw exceptions and will be executed in the try block

#define OSCL_TRY_NO_TLS __trapimp,
_leave_status,
_statements       _PV_TRAP_NO_TLS(__trapimp,_leave_status,_statements)
 

#define OsclErrAlreadyExists   106
 

#define OsclErrAlreadyInstalled   116
 

#define OsclErrArgument   104
 

#define OsclErrBadHandle   105
 

#define OsclErrBusy   107
 

#define OsclErrCancelled   102
 

#define OsclErrCorrupt   109
 

#define OsclErrGeneral   100
 

#define OsclErrInvalidState   113
 

#define OsclErrNoHandler   118
 

#define OsclErrNoMemory   101
 

#define OsclErrNone   0
 

#define OsclErrNoResources   114
 

#define OsclErrNotInstalled   115
 

#define OsclErrNotReady   108
 

#define OsclErrNotSupported   103
 

#define OsclErrOverflow   111
 

#define OsclErrSystemCallFailed   117
 

#define OsclErrThreadContextIncorrect   119
 

#define OsclErrTimeout   110
 

#define OsclErrUnderflow   112
 

#define OsclFailure   -1
 

#define OsclPending   1
 

#define OsclSuccess   0
 

 
#define PVError_DoLeave      internalLeave __ilv;__ilv.a=0;throw(__ilv)
 

#define PVERROR_IMP_JUMPS
 

Internal leave/trap implementation.

#define PVERRORTRAP_REGISTRY   OsclTLSRegistry
 

#define PVERRORTRAP_REGISTRY_ID   OSCL_TLS_ID_PVERRORTRAP
 


Typedef Documentation

typedef int32 OsclLeaveCode
 

Leave Codes

typedef int32 OsclReturnCode
 

Return Codes

typedef void(* OsclTrapOperation)(OsclAny*)
 

OsclTrapItem may be used in the cleanup stack when a custom cleanup operation is needed.


Function Documentation

OSCL_IMPORT_REF int OSCL_GetLastError  
 

This function returns the value of the system's global error number variable.

Returns:
Returns 0 for system's that do not have this functionality The value of the error number variable does not change until the user calls SetLastError or if another system call occurs that changes the value Supported Platforms: Win32/wince, Unix Unsupported Platforms : Symbian

OSCL_IMPORT_REF bool OSCL_IsErrnoSupported  
 

This function determines if a particular system saves the error number that occurs on a system call.

Returns:
This method returns false on systems that do not save the error number that occurs on a system call in a global variable. Returns true for systems that do save the error number

OSCL_IMPORT_REF bool OSCL_SetLastError int    newVal
 

This function sets the last error code for the system.

Parameters:
newVal  This value represents the new value for the global error number This method can be used to reset the error number after having retrieved it using GetLastError. Supported Platforms: Win32/wince, Unix Unsupported Platforms : Symbian

OSCL_IMPORT_REF char* OSCL_StrError int    errnum
 

This function maps an error number to an error-message string.

Parameters:
errnum  This value represents the error number to map
Returns:
This method returns a pointer to a string containing the system error-message. It returns NULL for systems that do not have this functionality Supported Platforms: Win32/wince, Unix Unsupported Platforms : Symbian


OSCL API
Posting Version: OPENCORE_20090310