[librsvg] Document DefsLookupErrorKind
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Document DefsLookupErrorKind
- Date: Tue, 5 May 2020 17:08:56 +0000 (UTC)
commit c30e8b938f236e939ba5d5989074915d54dbaf1b
Author: Federico Mena Quintero <federico gnome org>
Date: Mon May 4 18:38:42 2020 -0500
Document DefsLookupErrorKind
rsvg_internals/src/error.rs | 15 +++++++++++++++
1 file changed, 15 insertions(+)
---
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 58405dda..cf05f35d 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -94,10 +94,25 @@ impl fmt::Display for ElementError {
}
}
+/// Errors returned when looking up a resource by URL reference.
#[derive(Debug, Clone, PartialEq)]
pub enum DefsLookupErrorKind {
+ /// Error when parsing an [`Href`].
+ ///
+ /// [`Href`]: allowed_url/enum.Href.html
HrefError(HrefError),
+
+ /// Used when the public API tries to look up an external URL, which is not allowed.
+ ///
+ /// This catches the case where a public API wants to be misused to access an external
+ /// resource. For example, `SvgHandle.has_sub("https://evil.com/phone_home#element_id") will
+ /// fail with this error.
CannotLookupExternalReferences,
+
+ /// For internal use only.
+ ///
+ // FIXME: this is returned internally from Handle.lookup_node(), and gets translated
+ // to Ok(false). Don't expose this internal code in the public API.
NotFound,
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]