fix: expose ollama error (#2378)
This commit is contained in:
@@ -93,11 +93,11 @@ where
|
|||||||
|
|
||||||
struct CodeVisitor;
|
struct CodeVisitor;
|
||||||
|
|
||||||
impl Visitor<'_> for CodeVisitor {
|
impl<'de> Visitor<'de> for CodeVisitor {
|
||||||
type Value = Option<String>;
|
type Value = Option<String>;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
formatter.write_str("a string or a number for the code field")
|
formatter.write_str("a string, a number, null, or none for the code field")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||||
@@ -120,9 +120,23 @@ where
|
|||||||
{
|
{
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_unit<E>(self) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: de::Error,
|
||||||
|
{
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
|
||||||
|
where
|
||||||
|
D: serde::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
deserializer.deserialize_any(CodeVisitor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deserializer.deserialize_any(CodeVisitor)
|
deserializer.deserialize_option(CodeVisitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OpenAIError {
|
impl OpenAIError {
|
||||||
|
|||||||
Reference in New Issue
Block a user