thruster-core 0.8.0

The core pieces of the thruster web framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pub use thruster_core_async_await::errors::ThrusterError;
use crate::context::Context;

pub trait Error<C> {
  fn build_context(self) -> C;
}

impl<C: Context> Error<C> for ThrusterError<C> {
  fn build_context(self) -> C {
    let mut context = self.context;

    context.set_body(format!("{{\"message\": \"{}\",\"success\":false}}", self.message).as_bytes().to_vec());
    context
  }
}