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

error codes in client code

From: Daniel Stenberg <daniel_at_haxx.se>
Date: 2002-01-28 14:52:38 CET

I've previously mailed about what I think is a slight error code confusion in
the cmdline source code.

The current situtation is that we have *one* single include file with error
codes. That include file is for all errors the svn libraries might use.

The command line client code is but a user of the libraries and its private
errors should not be present in the global error code include file.

I've started on a "client_errors.h" file right now, that currently only
contains a set of new error codes that the EDITOR stuff (in my working copy)
uses. It is included below to give you an idea of how I imagine this to work.

Issues regarding this:

1. Several places in the client code, use library error codes when error
   messages are generated. I don't think this is a good idea, as the error
   code could be used to see in which domain the problem is, and thus I
   think client code should only use its own error codes when generating
   errors.

2. The errors currently named SVN_ERR_CL_* in the svn_error_codes.h should
   (if you agree) be used by errors generated by libsvn_client.

3. Regarding naming, is the error codes to be considered private? I mean
   should thet have two underscores or only one?

Comments?

This is the first draft of 'client_errors.h'. This would need to get more
codes added and some codes should possibly be removed from svn_error_codes.h

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#define SVN_ERROR_START \
        typedef enum svn_client_errno_t { \
          SVN_CL__WARNING = SVN_ERR_LAST + 1,
#define SVN_ERRDEF(n, s) n,
#define SVN_ERROR_END SVN_CL__ERR_LAST } svn_client_errno_t;

#define SVN_ERROR_ENUM_DEFINED

/* Define custom command line client error numbers */

SVN_ERROR_START

  /* BEGIN Client errors */

  SVN_ERRDEF (SVN_ERR_CL__FAILED_WRITING_TO_TEMPORARY_FILE,
              "Failed writing to temporary file.")

  SVN_ERRDEF (SVN_ERR_CL__FAILED_STAT_ON_TEMPORARY_FILE,
              "Failed getting info about temporary file.")

  SVN_ERRDEF (SVN_ERR_CL__FAILED_OPENING_TEMPORARY_FILE,
              "Failed opening temporary file.")

  SVN_ERRDEF (SVN_ERR_CL__FAILED_READING_TEMPORARY_FILE,
              "Failed reading temporary file.")

  /* END Client errors */

SVN_ERROR_END

#undef SVN_ERROR_START
#undef SVN_ERRDEF
#undef SVN_ERROR_END

#ifdef __cplusplus
}
#endif /* __cplusplus */

/* ----------------------------------------------------------------
 * local variables:
 * eval: (load-file "../../svn-dev.el")
 * end:
 */

-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:00 2006

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.