mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-26 23:23:20 +03:00
Better hexadecimal digit parsing error description.
This commit is contained in:
parent
0185c0be14
commit
0c92430520
7
integration/hurl/tests_error_parser/hexdigit.err
Normal file
7
integration/hurl/tests_error_parser/hexdigit.err
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
error: Parsing hexadecimal number
|
||||||
|
--> tests_error_parser/hexdigit.hurl:2:17
|
||||||
|
|
|
||||||
|
2 | {"smiley":"\uf64"}
|
||||||
|
| ^ expecting a valid hexadecimal number
|
||||||
|
|
|
||||||
|
|
1
integration/hurl/tests_error_parser/hexdigit.exit
Normal file
1
integration/hurl/tests_error_parser/hexdigit.exit
Normal file
@ -0,0 +1 @@
|
|||||||
|
2
|
3
integration/hurl/tests_error_parser/hexdigit.hurl
Normal file
3
integration/hurl/tests_error_parser/hexdigit.hurl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
POST http://localhost:8000/data
|
||||||
|
{"smiley":"\uf64"}
|
||||||
|
HTTP 200
|
3
integration/hurl/tests_error_parser/hexdigit.ps1
Normal file
3
integration/hurl/tests_error_parser/hexdigit.ps1
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Set-StrictMode -Version latest
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
hurl tests_error_parser/hexdigit.hurl
|
3
integration/hurl/tests_error_parser/hexdigit.sh
Executable file
3
integration/hurl/tests_error_parser/hexdigit.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
hurl tests_error_parser/hexdigit.hurl
|
@ -42,6 +42,7 @@ impl Error for parser::Error {
|
|||||||
ParseError::FileContentType => "Parsing file content type".to_string(),
|
ParseError::FileContentType => "Parsing file content type".to_string(),
|
||||||
ParseError::Filename => "Parsing filename".to_string(),
|
ParseError::Filename => "Parsing filename".to_string(),
|
||||||
ParseError::GraphQlVariables => "Parsing GraphQL variables".to_string(),
|
ParseError::GraphQlVariables => "Parsing GraphQL variables".to_string(),
|
||||||
|
ParseError::HexDigit => "Parsing hexadecimal number".to_string(),
|
||||||
ParseError::InvalidCookieAttribute => "Parsing cookie attribute".to_string(),
|
ParseError::InvalidCookieAttribute => "Parsing cookie attribute".to_string(),
|
||||||
ParseError::Json(_) => "Parsing JSON".to_string(),
|
ParseError::Json(_) => "Parsing JSON".to_string(),
|
||||||
ParseError::JsonPathExpr => "Parsing JSONPath expression".to_string(),
|
ParseError::JsonPathExpr => "Parsing JSONPath expression".to_string(),
|
||||||
@ -65,7 +66,6 @@ impl Error for parser::Error {
|
|||||||
ParseError::Xml => "Parsing XML".to_string(),
|
ParseError::Xml => "Parsing XML".to_string(),
|
||||||
// TODO: implement all variants
|
// TODO: implement all variants
|
||||||
// _ => ,
|
// _ => ,
|
||||||
ParseError::HexDigit => format!("{self:?}"),
|
|
||||||
ParseError::InvalidOption => format!("{self:?}"),
|
ParseError::InvalidOption => format!("{self:?}"),
|
||||||
ParseError::Unicode => format!("{self:?}"),
|
ParseError::Unicode => format!("{self:?}"),
|
||||||
ParseError::Url => format!("{self:?}"),
|
ParseError::Url => format!("{self:?}"),
|
||||||
@ -73,7 +73,7 @@ impl Error for parser::Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fixme(&self) -> String {
|
fn fixme(&self) -> String {
|
||||||
match self.inner.clone() {
|
match &self.inner {
|
||||||
ParseError::DuplicateSection => "the section is already defined".to_string(),
|
ParseError::DuplicateSection => "the section is already defined".to_string(),
|
||||||
ParseError::EscapeChar => "the escaping sequence is not valid".to_string(),
|
ParseError::EscapeChar => "the escaping sequence is not valid".to_string(),
|
||||||
ParseError::Expecting { value } => format!("expecting '{value}'"),
|
ParseError::Expecting { value } => format!("expecting '{value}'"),
|
||||||
@ -82,6 +82,7 @@ impl Error for parser::Error {
|
|||||||
ParseError::GraphQlVariables => {
|
ParseError::GraphQlVariables => {
|
||||||
"GraphQL variables is not a valid JSON object".to_string()
|
"GraphQL variables is not a valid JSON object".to_string()
|
||||||
}
|
}
|
||||||
|
ParseError::HexDigit => "expecting a valid hexadecimal number".to_string(),
|
||||||
ParseError::InvalidCookieAttribute => "the cookie attribute is not valid".to_string(),
|
ParseError::InvalidCookieAttribute => "the cookie attribute is not valid".to_string(),
|
||||||
ParseError::Json(variant) => match variant {
|
ParseError::Json(variant) => match variant {
|
||||||
JsonErrorVariant::TrailingComma => "trailing comma is not allowed".to_string(),
|
JsonErrorVariant::TrailingComma => "trailing comma is not allowed".to_string(),
|
||||||
@ -141,7 +142,6 @@ impl Error for parser::Error {
|
|||||||
ParseError::Xml => "invalid XML".to_string(),
|
ParseError::Xml => "invalid XML".to_string(),
|
||||||
// TODO: implement all variants
|
// TODO: implement all variants
|
||||||
// _ => format!("{self:?}"),
|
// _ => format!("{self:?}"),
|
||||||
ParseError::HexDigit => format!("{self:?}"),
|
|
||||||
ParseError::InvalidOption => format!("{self:?}"),
|
ParseError::InvalidOption => format!("{self:?}"),
|
||||||
ParseError::Unicode => format!("{self:?}"),
|
ParseError::Unicode => format!("{self:?}"),
|
||||||
ParseError::Url => format!("{self:?}"),
|
ParseError::Url => format!("{self:?}"),
|
||||||
|
Loading…
Reference in New Issue
Block a user