* dav_handle_err() * * Handle the standard error processing. must be non-NULL. * * is set by the following: * - dav_validate_request() * - dav_add_lock() * - repos_hooks->remove_resource * - repos_hooks->move_resource * - repos_hooks->copy_resource * - vsn_hooks->update */
| 642 | * - vsn_hooks->update |
| 643 | */ |
| 644 | DAV_DECLARE(int) dav_handle_err(request_rec *r, dav_error *err, |
| 645 | dav_response *response) |
| 646 | { |
| 647 | /* log the errors */ |
| 648 | dav_log_err(r, err, APLOG_ERR); |
| 649 | |
| 650 | if (!ap_is_HTTP_VALID_RESPONSE(err->status)) { |
| 651 | /* we have responded already */ |
| 652 | return AP_FILTER_ERROR; |
| 653 | } |
| 654 | |
| 655 | if (response == NULL) { |
| 656 | dav_error *stackerr = err; |
| 657 | |
| 658 | /* our error messages are safe; tell Apache this */ |
| 659 | apr_table_setn(r->notes, "verbose-error-to", "*"); |
| 660 | |
| 661 | /* Didn't get a multistatus response passed in, but we still |
| 662 | might be able to generate a standard <D:error> response. |
| 663 | Search the error stack for an errortag. */ |
| 664 | while (stackerr != NULL && stackerr->tagname == NULL) |
| 665 | stackerr = stackerr->prev; |
| 666 | |
| 667 | if (stackerr != NULL && stackerr->tagname != NULL) |
| 668 | return dav_error_response_tag(r, stackerr); |
| 669 | |
| 670 | return err->status; |
| 671 | } |
| 672 | |
| 673 | /* send the multistatus and tell Apache the request/response is DONE. */ |
| 674 | dav_send_multistatus(r, err->status, response, NULL); |
| 675 | return DONE; |
| 676 | } |
| 677 | |
| 678 | /* handy function for return values of methods that (may) create things. |
| 679 | * locn if provided is assumed to be escaped. */ |
no test coverage detected