[librsvg] rsvg_handle_acquire_data() / acquire_stream(): Return more descriptive errors
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] rsvg_handle_acquire_data() / acquire_stream(): Return more descriptive errors
- Date: Thu, 29 Nov 2018 18:05:49 +0000 (UTC)
commit 4509dadf363f1f71d5e283b8d63fbf776503c327
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Nov 28 14:13:38 2018 -0600
rsvg_handle_acquire_data() / acquire_stream(): Return more descriptive errors
rsvg_internals/src/handle.rs | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index f6cad761..2e72c226 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -1,4 +1,5 @@
use std::cell::{Ref, RefCell};
+use std::error::Error;
use std::ptr;
use cairo::{ImageSurface, Status};
@@ -291,8 +292,8 @@ pub unsafe extern "C" fn rsvg_handle_acquire_data(
let aurl = match AllowedUrl::from_href(&href_str, rhandle.base_url.borrow().as_ref()) {
Ok(a) => a,
- Err(_) => {
- set_gerror(error, 0, "URL is not allowed");
+ Err(e) => {
+ set_gerror(error, 0, &format!("{}", e));
return ptr::null_mut();
}
};
@@ -307,8 +308,8 @@ pub unsafe extern "C" fn rsvg_handle_acquire_data(
io::binary_data_to_glib(&binary, ptr::null_mut(), out_len)
}
- Err(_) => {
- set_gerror(error, 0, "Could not acquire data");
+ Err(e) => {
+ set_gerror(error, 0, e.description());
*out_len = 0;
ptr::null_mut()
}
@@ -329,8 +330,8 @@ pub unsafe extern "C" fn rsvg_handle_acquire_stream(
let aurl = match AllowedUrl::from_href(&href_str, rhandle.base_url.borrow().as_ref()) {
Ok(a) => a,
- Err(_) => {
- set_gerror(error, 0, "URL is not allowed");
+ Err(e) => {
+ set_gerror(error, 0, &format!("{}", e));
return ptr::null_mut();
}
};
@@ -344,8 +345,8 @@ pub unsafe extern "C" fn rsvg_handle_acquire_stream(
stream.to_glib_full()
}
- Err(_) => {
- set_gerror(error, 0, "Could not acquire stream");
+ Err(e) => {
+ set_gerror(error, 0, e.description());
ptr::null_mut()
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]