Changeset 2158


Ignore:
Timestamp:
05/05/2008 22:04:33 (4 years ago)
Author:
chris
Message:

Catch server errors when listing a directory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/bin/bbackupquery/BackupQueries.cpp

    r2157 r2158  
    411411                        BOX_ERROR("Directory '" << args[0] << "' not found " 
    412412                                "on store."); 
     413                        SetReturnCode(COMMAND_RETURN_ERROR); 
    413414                        return; 
    414415                } 
     
    436437 
    437438        // Do communication 
    438         mrConnection.QueryListDirectory( 
    439                         DirID, 
    440                         BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING,    // both files and directories 
    441                         excludeFlags, 
    442                         true /* want attributes */); 
     439        try 
     440        { 
     441                mrConnection.QueryListDirectory( 
     442                                DirID, 
     443                                BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING, 
     444                                // both files and directories 
     445                                excludeFlags, 
     446                                true /* want attributes */); 
     447        } 
     448        catch (std::exception &e) 
     449        { 
     450                BOX_ERROR("Failed to list directory: " << e.what()); 
     451                SetReturnCode(COMMAND_RETURN_ERROR); 
     452                return; 
     453        } 
     454        catch (...) 
     455        { 
     456                BOX_ERROR("Failed to list directory: unknown error"); 
     457                SetReturnCode(COMMAND_RETURN_ERROR); 
     458                return; 
     459        } 
     460 
    443461 
    444462        // Retrieve the directory from the stream following 
     
    756774        { 
    757775                BOX_ERROR("Incorrect usage. cd [-o] [-d] <directory>"); 
     776                SetReturnCode(COMMAND_RETURN_ERROR); 
    758777                return; 
    759778        } 
     
    773792        { 
    774793                BOX_ERROR("Directory '" << args[0] << "' not found."); 
     794                SetReturnCode(COMMAND_RETURN_ERROR); 
    775795                return; 
    776796        } 
Note: See TracChangeset for help on using the changeset viewer.