-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor #6
Refactor #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you're still looking for a code review, I've added a few comments here.
#[derive(Debug)] | ||
pub enum UrlParseError { | ||
NoPath, | ||
NotHttps, | ||
Parser(url::ParseError), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need this, or does url
's ParseError
cover everything? It seems to me that it does: https://docs.rs/url/latest/url/enum.ParseError.html#variants
if uri.scheme() != "https" { | ||
return Err(UrlParseError::NotHttps); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reasoning behind mandating https
? If Firebase has a problem with http
, it should probably be reported from their side, not manually from the library.
use std::fmt::{Display, Formatter}; | ||
|
||
#[derive(Debug)] | ||
pub enum UrlParseError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should create a type alias to Result<T, UrlParseError>
and use it instead, e.g. in src/utils.rs
' check_uri
function.
} | ||
|
||
#[derive(Debug)] | ||
pub enum RequestError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same comment regarding a custom Result
type goes for here.
/* | ||
Firebase REST API | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This top-level crate documentation was a great idea. Maybe not in this PR, but eventually I highly recommend writing doc comments for everything, including top-level module documentation.
No description provided.