Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r6 - trunk/php_svn_client.c

php-svn-client
Discussion topic

Back to topic list

svn commit: r6 - trunk/php_svn_client.c

Reply

Author fedortyurin
Full name Fedor Tyurin
Date 2006-12-18 04:38:24 PST
Message Author: fedortyurin
Date: 2006-12-18 04:38:23-0800
New Revision: 6

Modified:
   trunk/php_svn_client.c

Log:
SVN errors handeling was added

Modified: trunk/php_svn_client.c
Url: http://php-svn-clien​t.tigris.org/source/​browse/php-svn-clien​t/trunk/php_svn_clie​nt.c?view=diff&r​ev=6&p1=trunk/ph​p_svn_client.c&p​2=trunk/php_svn_clie​nt.c&r1=5&r2​=6
====================​====================​====================​==================
--- trunk/php_svn_client.c (original)
+++ trunk/php_svn_client.c 2006-12-18 04:38:23-0800
@@ -67,7 +67,7 @@
     PHP_RINIT(svn_client),
     PHP_RSHUTDOWN(svn_client),
     PHP_MINFO(svn_client),
- "1.0",
+ "0.1",
     PHP_MODULE_GLOBALS(svn_client),
     PHP_GINIT(svn_client),
     NULL,
@@ -105,6 +105,53 @@
     return;
 }
 
+static void php_svn_client_handl​e_error(svn_error_t *err TSRMLS_DC)
+{
+ svn_error_t *err1;
+
+ char *err_msg = 0;
+ char *err_msg1 = 0;
+
+ const char err_msg_prefix[] = "php_svn_client: errors count = %d: ";
+ const char err_msg_separator[] = "; ";
+
+ unsigned int err_msg_len = 0;
+ unsigned int err_count = 0;
+
+ err_msg_len = strlen(err_msg_prefix);
+ err1 = err;
+ while (err1) {
+ if (err1->message) {
+ err_msg_len += strlen(err1->message);
+ }
+ err1 = err1->child;
+ if (err1&&(err1​->message)) {
+ err_msg_len += strlen(err_msg_separator);
+ }
+ err_count++;
+ }
+
+ err_msg = (char*) malloc(err_msg_len);
+
+ err_msg1 = err_msg;
+
+ sprintf(err_msg1, err_msg_prefix, err_count); err_msg1 = err_msg + strlen(err_msg);
+
+ err1 = err;
+ while (err1) {
+ if (err1->message) {
+ sprintf(err_msg1, "%s", err1->message); err_msg1 = err_msg + strlen(err_msg);
+ }
+ err1 = err1->child;
+ if (err1&&(err1​->message)) {
+ sprintf(err_msg1, err_msg_separator); err_msg1 = err_msg + strlen(err_msg);
+ }
+ }
+
+ php_error_docref(NULL TSRMLS_CC, E_USER_WARNING, err_msg);
+ free(err_msg);
+}
+
 static svn_error_t *php_prompt_svn_auth​_ssl_server_trust (
     svn_auth_cred_ssl_se​rver_trust_t **cred,
     void *baton,
@@ -176,7 +223,8 @@
     err = check_lib_versions();
     if (err)
     {
- php_error_docref(NULL TSRMLS_CC, E_USER_ERROR, err->message);
+ php_svn_client_handle_error(err TSRMLS_CC);
+ svn_error_clear(err);
         return FAILURE;
     }
 
@@ -184,7 +232,8 @@
     err = svn_ra_initialize(SVN_G(pool));
     if (err)
     {
- php_error_docref(NULL TSRMLS_CC, E_USER_ERROR, err->message);
+ php_svn_client_handle_error(err TSRMLS_CC);
+ svn_error_clear(err);
         return FAILURE;
     }
 
@@ -439,13 +488,14 @@
     revision.kind = svn_opt_revision_unspecified;
 
     if (!svn_path_is_url(url)) {
- printf("Wrong url\n");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_USER_WARNING, "Wrong URL");
+ RETURN_FALSE;
     }
 
     err = svn_opt_parse_path(​&peg_revision, &true_url, url, SVN_G(pool));
     if (err) {
- printf("%s\n", err->message);
+ php_svn_client_handle_error(err TSRMLS_CC);
+ svn_error_clear(err);
         RETURN_FALSE;
     }
 
@@ -467,9 +517,9 @@
                                    ctx, SVN_G(pool));
 
     if (err) {
- svn_cmdline_handle_e​xit_error(err, SVN_G(pool), "test1: ");
-// svn_handle_error2(err, stderr, 0, "test1: ");
-// svn_error_clear(err);
+ php_svn_client_handle_error(err TSRMLS_CC);
+ svn_error_clear(err);
+ RETURN_FALSE;
     }
 
     return;

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r6 - trunk/php_svn_client.c fedortyurin Fedor Tyurin 2006-12-18 04:38:24 PST
Messages per page: