Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3642

Show
Ignore:
Timestamp:
06/19/08 16:41:25 (6 months ago)
Author:
kris
Message:

removed Exception throw from detach() ... need to revisit this interface, since it ought to return a bool instead.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/io/DeviceConduit.d

    r2913 r3642  
    4040        final void error () 
    4141        { 
    42                 super.error (toString() ~ " :: " ~ SysError.lastMsg); 
     42                super.error (this.toString ~ " :: " ~ SysError.lastMsg); 
    4343        } 
    4444 
     
    4949        ***********************************************************************/ 
    5050 
    51         override char[] toString() 
     51        override char[] toString () 
    5252        { 
    5353                return "<device>"; 
     
    9999                /*************************************************************** 
    100100 
    101                         Release the underlying file 
     101                        Release the underlying file. Note that an exception 
     102                        is not thrown on error, as doing so can induce some 
     103                        spaggetti into error handling. Instead, we need to 
     104                        change this to return a bool instead, so the caller 
     105                        can decide what to do.                         
    102106 
    103107                ***************************************************************/ 
     
    106110                { 
    107111                        if (handle) 
    108                             if (! CloseHandle (handle)) 
    109                                   error (); 
     112                            CloseHandle (handle); 
    110113                        handle = cast(HANDLE) null; 
    111114                } 
     
    131134                                  return Eof; 
    132135                              else 
    133                                  error ()
     136                                 error
    134137 
    135138                        if (read is 0 && dst.length > 0) 
     
    150153 
    151154                        if (! WriteFile (handle, src.ptr, src.length, &written, null)) 
    152                               error ()
     155                              error
    153156 
    154157                        return written; 
     
    199202                        if (handle >= 0) 
    200203                            if (posix.close (handle) is -1) 
    201                                 error ()
     204                                error
    202205                        handle = -1; 
    203206                } 
     
    214217                        int read = posix.read (handle, dst.ptr, dst.length); 
    215218                        if (read == -1) 
    216                             error ()
     219                            error
    217220                        else 
    218221                           if (read is 0 && dst.length > 0) 
     
    232235                        int written = posix.write (handle, src.ptr, src.length); 
    233236                        if (written is -1) 
    234                             error ()
     237                            error
    235238                        return written; 
    236239                }