mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-10 20:36:21 +00:00
reduce errors
This commit is contained in:
parent
ee7c59ecd1
commit
def8f6ca28
2 changed files with 0 additions and 35 deletions
|
@ -89,14 +89,6 @@ pub enum AstError {
|
||||||
UnclosedTag(String),
|
UnclosedTag(String),
|
||||||
#[error("unexpected tag: {0}")]
|
#[error("unexpected tag: {0}")]
|
||||||
UnexpectedTag(String),
|
UnexpectedTag(String),
|
||||||
#[error("invalid tag: {0}")]
|
|
||||||
InvalidTag(String),
|
|
||||||
#[error("block error: {0} in {1}")]
|
|
||||||
BlockError(String, String),
|
|
||||||
#[error("stream error: {0}")]
|
#[error("stream error: {0}")]
|
||||||
StreamError(String),
|
StreamError(String),
|
||||||
#[error("token error: {0}")]
|
|
||||||
TokenError(String),
|
|
||||||
#[error("argument error: {0} - {1}")]
|
|
||||||
ArgumentError(String, String),
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,36 +373,9 @@ impl From<AstError> for ParserError {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParserError {
|
impl ParserError {
|
||||||
pub fn unclosed_tag(tag: impl Into<String>) -> Self {
|
|
||||||
Self::Ast(AstError::UnclosedTag(tag.into()), None)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn unexpected_tag(tag: impl Into<String>) -> Self {
|
|
||||||
Self::Ast(AstError::UnexpectedTag(tag.into()), None)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn invalid_tag(kind: impl Into<String>) -> Self {
|
|
||||||
Self::Ast(AstError::InvalidTag(kind.into()), None)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn block_error(kind: impl Into<String>, name: impl Into<String>) -> Self {
|
|
||||||
Self::Ast(AstError::BlockError(kind.into(), name.into()), None)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn stream_error(kind: impl Into<String>) -> Self {
|
pub fn stream_error(kind: impl Into<String>) -> Self {
|
||||||
Self::Ast(AstError::StreamError(kind.into()), None)
|
Self::Ast(AstError::StreamError(kind.into()), None)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn token_error(expected: impl Into<String>, actual: Token) -> Self {
|
|
||||||
Self::Ast(
|
|
||||||
AstError::TokenError(format!("expected {}, got {:?}", expected.into(), actual)),
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn argument_error(kind: impl Into<String>, details: impl Into<String>) -> Self {
|
|
||||||
Self::Ast(AstError::ArgumentError(kind.into(), details.into()), None)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue