error.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) Sergey P. Derevyago, 2008-2009.
00003  *
00004  * Permission to copy, use, modify, sell and distribute this software is granted
00005  * provided this copyright notice appears in all copies.
00006  * This software is provided "as is" without express or implied warranty, and
00007  * with no claim as to its suitability for any purpose.
00008  *
00009  */
00010 
00017 #ifndef __DERS__ERROR_HPP__
00018 #define __DERS__ERROR_HPP__
00019 
00020 #include <ders/config.hpp>
00021 #include <ders/exception.hpp>
00022 
00023 namespace ders {  // ::ders
00024 
00028 enum error {
00029   ezero=           0,  // No error
00030   e2big=           1,  // Argument list too long
00031   eacces=          2,  // Permission denied
00032   eaddrinuse=      3,  // Address in use
00033   eaddrnotavail=   4,  // Address not available
00034   eafnosupport=    5,  // Address family not supported
00035   eagain=          6,  // Resource unavailable, try again
00036   ealready=        7,  // Connection already in progress
00037   ebadf=           8,  // Bad file descriptor
00038   ebadmsg=         9,  // Bad message
00039   ebusy=          10,  // Device or resource busy
00040   ecanceled=      11,  // Operation canceled
00041   echild=         12,  // No child processes
00042   econnaborted=   13,  // Connection aborted
00043   econnrefused=   14,  // Connection refused
00044   econnreset=     15,  // Connection reset
00045   edeadlk=        16,  // Resource deadlock would occur
00046   edestaddrreq=   17,  // Destination address required
00047   edom=           18,  // Mathematics argument out of domain of function
00048   edquot=         19,  // Reserved (EDQUOT)
00049   eexist=         20,  // File exists
00050   efault=         21,  // Bad address
00051   efbig=          22,  // File too large
00052   ehostunreach=   23,  // Host is unreachable
00053   eidrm=          24,  // Identifier removed
00054   eilseq=         25,  // Illegal byte sequence
00055   einprogress=    26,  // Operation in progress
00056   eintr=          27,  // Interrupted function
00057   einval=         28,  // Invalid argument
00058   eio=            29,  // I/O error
00059   eisconn=        30,  // Socket is connected
00060   eisdir=         31,  // Is a directory
00061   eloop=          32,  // Too many levels of symbolic links
00062   emfile=         33,  // Too many open files
00063   emlink=         34,  // Too many links
00064   emsgsize=       35,  // Message too large
00065   emultihop=      36,  // Reserved (EMULTIHOP)
00066   enametoolong=   37,  // Filename too long
00067   enetdown=       38,  // Network is down
00068   enetreset=      39,  // Connection aborted by network
00069   enetunreach=    40,  // Network unreachable
00070   enfile=         41,  // Too many files open in system
00071   enobufs=        42,  // No buffer space available
00072   enodata=        43,  // No message is available on the STREAM head read queue
00073   enodev=         44,  // No such device
00074   enoent=         45,  // No such file or directory
00075   enoexec=        46,  // Executable file format error
00076   enolck=         47,  // No locks available
00077   enolink=        48,  // Reserved (ENOLINK)
00078   enomem=         49,  // Not enough space
00079   enomsg=         50,  // No message of the desired type
00080   enoprotoopt=    51,  // Protocol not available
00081   enospc=         52,  // No space left on device
00082   enosr=          53,  // No STREAM resources
00083   enostr=         54,  // Not a STREAM
00084   enosys=         55,  // Function not supported
00085   enotconn=       56,  // The socket is not connected
00086   enotdir=        57,  // Not a directory
00087   enotempty=      58,  // Directory not empty
00088   enotsock=       59,  // Not a socket
00089   enotsup=        60,  // Not supported
00090   enotty=         61,  // Inappropriate I/O control operation
00091   enxio=          62,  // No such device or address
00092   eopnotsupp=     63,  // Operation not supported on socket
00093   eoverflow=      64,  // Value too large to be stored in data type
00094   eperm=          65,  // Operation not permitted
00095   epipe=          66,  // Broken pipe
00096   eproto=         67,  // Protocol error
00097   eprotonosupport=68,  // Protocol not supported
00098   eprototype=     69,  // Protocol wrong type for socket
00099   erange=         70,  // Result too large
00100   erofs=          71,  // Read-only file system
00101   espipe=         72,  // Invalid seek
00102   esrch=          73,  // No such process
00103   estale=         74,  // Reserved (ESTALE)
00104   etime=          75,  // Stream ioctl() timeout
00105   etimedout=      76,  // Connection timed out
00106   etxtbsy=        77,  // Text file busy
00107   eunkn=          78,  // Unknown error
00108   ewouldblock=    79,  // Operation would block
00109   exdev=          80   // Cross-device link
00110 };
00111 
00118 sh_text error_message(mem_pool& mp, error err);
00119 
00125 error convert_errno(int val);
00126 
00127 shException newErrorException(mem_pool& mp, const FileLine& loc, const ch_rng&
00128   msg, error err);
00129 shException newErrorException(const FileLine& loc, const ch_rng& msg, error err,
00130   shException nest);
00131 
00135 class ErrorException : public Exception {
00136       friend shException newErrorException(const FileLine& loc, const ch_rng&
00137         msg, error err, shException nest);
00138 
00139       ErrorException(const ErrorException&);
00140       ErrorException& operator=(const ErrorException&);
00141 
00142  protected:
00143       ErrorException(const FileLine& loc, const ch_rng& msg, error err,
00144         shException nest);
00145 
00146  public:
00147       const error errorCode;
00148 
00149       virtual sh_text getClassName() const;
00150       virtual sh_text toText() const;
00151 
00152       virtual void destroy(mem_pool& mp2) { destroy_this(this, mp2); }
00153 };
00154 
00155 }  // namespace ::ders
00156 
00157 #endif  // __DERS__ERROR_HPP__
00158 

Generated on Tue Dec 8 11:35:32 2009 for derslib by  doxygen 1.5.5