2 * util_error.c : serf utility routines for wrapping serf status codes
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
26 #include "private/svn_error_private.h"
31 * Undefine the helpers for creating errors.
33 * *NOTE*: Any use of these functions in any other function may need
34 * to call svn_error__locate() because the macro that would otherwise
35 * do this is being undefined and the filename and line number will
36 * not be properly set in the static error_file and error_line
39 #undef svn_error_create
40 #undef svn_error_createf
41 #undef svn_error_quick_wrap
42 #undef svn_error_wrap_apr
43 #undef svn_ra_serf__wrap_err
46 svn_ra_serf__wrap_err(apr_status_t status,
50 const char *serf_err_msg = serf_error_string(status);
54 err = svn_error_create(status, NULL, NULL);
56 if (serf_err_msg || fmt)
60 char errbuf[255]; /* Buffer for APR error message. */
64 err_msg = serf_err_msg;
68 svn_error_t *utf8_err;
70 /* Grab the APR error message. */
71 apr_strerror(status, errbuf, sizeof(errbuf));
72 utf8_err = svn_utf_cstring_to_utf8(&err_msg, errbuf, err->pool);
75 svn_error_clear(utf8_err);
78 /* Append it to the formatted message. */
82 msg = apr_pvsprintf(err->pool, fmt, ap);
91 err->message = apr_pstrcat(err->pool, msg, ": ", err_msg,