A tool to compile SQL to Elasticsearch queries
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

12345678910111213141516171819202122232425262728
  1. use std::{error::Error, fmt, fmt::Display};
  2. #[derive(Debug, PartialEq)]
  3. pub struct KappeError {
  4. pub message: String,
  5. }
  6. impl KappeError {
  7. pub fn new(message: &str) -> Self {
  8. Self {
  9. message: message.to_string(),
  10. }
  11. }
  12. }
  13. impl Display for KappeError {
  14. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  15. write!(f, "{}", &self.message)
  16. }
  17. }
  18. impl Error for KappeError {}
  19. impl From<KappeError> for std::io::Error {
  20. fn from(e: KappeError) -> Self {
  21. Self::new(std::io::ErrorKind::InvalidInput, e.message)
  22. }
  23. }