Skip to content

Commit d7c667e

Browse files
TatriXMartinKavik
authored andcommitted
docs(fetch): Add missing "Errors" docstrings
1 parent 802d5d5 commit d7c667e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/browser/fetch/response.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ pub struct Response {
1414

1515
impl Response {
1616
/// Get a `String` from response body.
17+
///
18+
/// # Errors
19+
/// Returns `FetchError::PromiseError`.
1720
pub async fn text(self) -> Result<String> {
1821
let js_promise = self.raw_response.text().map_err(FetchError::PromiseError)?;
1922

@@ -27,6 +30,9 @@ impl Response {
2730
}
2831

2932
/// JSON parse response body into provided type.
33+
///
34+
/// # Errors
35+
/// Returns `FetchError::SerdeError` or `FetchError::PromiseError`.
3036
pub async fn json<T: DeserializeOwned + 'static>(self) -> Result<T> {
3137
let text = self.text().await?;
3238
serde_json::from_str(&text).map_err(FetchError::SerdeError)

0 commit comments

Comments
 (0)