[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: RFC: svn_io_file_write_full and svn_io_file_read(_full)

From: Erik Huelsmann <e.huelsmann_at_gmx.net>
Date: 2003-11-26 18:22:03 CET

>> The wrappers would extract the filename from the apr_file_t structure as
>> is done in apr_file_close and add that to the specific error message.
>
> Note that you can also use apr_strerror() to get a message out of APR.

True, but that is an action currently implemented in svn_handle_error. It
would be possible to report the APR error in the lowest level, wrapping the
generic message "Can't ... to/from file '%s'" around it using
svn_error_quick_wrap indicating both the error (without a specific one) and the error from the
calling function like this (pseudo code):

svn_io_file_read_full ( )
{
  apr_status_t status;

  status = apr_file_read_full ( );
  if (status)
    {
      svn_error_t *err = svn_error_create( status, NULL, NULL); /* error
which otherwise would have been thrown by apr_file_read_full */
      return svn_error_quick_wrap( err, "Can't read from file '%s'",
svn_get_file_name ( file ))
    }
    return NO_ERROR;
}

Notes:
- I know svn_error_quick_wrap does not support fprintf format strings.
- The code is not complete, just meant as an example

bye,

Erik.

-- 
HoHoHo! Seid Ihr auch alle schön brav gewesen?
GMX Weihnachts-Special: Die 1. Adresse für Weihnachts-
männer und -frauen! http://www.gmx.net/de/cgi/specialmail
+++ GMX - die erste Adresse für Mail, Message, More! +++
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 26 18:23:00 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.