Error Reporting and Handling

Reporting Errors to the Component from Event Handlers

If the event has a ResultCode parameter, the event handler should use it to return the result code of the operation to the component. The ResultCode parameter is set to 0 by default, which indicates the operation was successful. If an problem occurs while handling the event, set the ResultCode parameter to one of the following values to inform the component about it:

RWRESULT_SUCCESS0x00000000Success.

Return if all data was successfully transferred.

RWRESULT_PARTIAL0x00000080Partial success.

Return if some, but not all, data was successfully transferred. I.e., when BytesRead < BytesToRead (for ReadData), or BytesWritten < BytesToWrite (for WriteData).

RWRESULT_RANGE_BEYOND_EOF0x00000081Requested range is beyond the end of the file (EOF).

For the ReadData event, returning this code indicates to the cache that there is no need to request data beyond (Position + BytesRead), and that the tail should be zeroed instead.

RWRESULT_FILE_MODIFIED_EXTERNALLY0x00000082The specified file's size was modified externally.

RWRESULT_FILE_MODIFIED_LOCALLY0x00000083The requested file's size was modified locally.

RWRESULT_FAILURE0x0000008DThe operation failed for some transient reason.

Returning this code indicates that, while the current request failed, it is safe to continue sending requests for both the specified file and others. (Other operations may continue.)

RWRESULT_FILE_FAILURE0x0000008EThe operation failed for some external-file-related reason.

Returning this code indicates that some failure related to the external file itself has occurred, and it is expected that any further requests made against that file will also fail. The component will not send any more requests for the specified file until the file-specific error is reset as described in Reporting Transport Errors.

RWRESULT_PERMANENT_FAILURE0x0000008FThe operation failed for some external-storage-related reason.

Returning this code indicates that some failure related to the external storage itself has occurred, and it is expected that all further requests will also fail. The component will not send any more requests for any file until the global error is reset as described in Reporting Transport Errors.

If an unhandled exception occurs in the event handler, it will be caught by the component, which will fire the OnError event.

How to Handle Errors Reported by the Component

The CBFS Cache component APIs communicate errors to applications using the error codes defined on the Error Codes page.

If an error occurs, the component will throw an exception. The Code property of the exception object will contain an error code, and the Message property will contain an error message (if available).

 
 
Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Cache 2020 .NET Edition - Version 20.0 [Build 7850]