@@ -56,6 +56,9 @@ pub trait WebhookHandler<Req, Res> {
56
56
fn call ( self , req : Req ) -> Res ;
57
57
}
58
58
59
+ /// A result type alias with the library-level [`Error`] type as the default error type.
60
+ pub type Result < T , E = WebhookError > = std:: result:: Result < T , E > ;
61
+
59
62
#[ derive( Debug , Snafu ) ]
60
63
pub enum WebhookError {
61
64
#[ snafu( display( "failed to create TLS server" ) ) ]
@@ -120,7 +123,7 @@ impl WebhookServer {
120
123
router : Router ,
121
124
options : Options ,
122
125
subject_alterative_dns_names : Vec < String > ,
123
- ) -> Result < ( Self , mpsc:: Receiver < Certificate > ) , WebhookError > {
126
+ ) -> Result < ( Self , mpsc:: Receiver < Certificate > ) > {
124
127
tracing:: trace!( "create new webhook server" ) ;
125
128
126
129
// TODO (@Techassi): Make opt-in configurable from the outside
@@ -154,7 +157,7 @@ impl WebhookServer {
154
157
/// Runs the Webhook server and sets up signal handlers for shutting down.
155
158
///
156
159
/// This does not implement graceful shutdown of the underlying server.
157
- pub async fn run ( self ) -> Result < ( ) , WebhookError > {
160
+ pub async fn run ( self ) -> Result < ( ) > {
158
161
let future_server = self . run_server ( ) ;
159
162
let future_signal = async {
160
163
let mut sigint = signal ( SignalKind :: interrupt ( ) ) . expect ( "create SIGINT listener" ) ;
@@ -187,7 +190,7 @@ impl WebhookServer {
187
190
188
191
/// Runs the webhook server by creating a TCP listener and binding it to
189
192
/// the specified socket address.
190
- async fn run_server ( self ) -> Result < ( ) , WebhookError > {
193
+ async fn run_server ( self ) -> Result < ( ) > {
191
194
tracing:: debug!( "run webhook server" ) ;
192
195
193
196
self . tls_server . run ( ) . await . context ( RunTlsServerSnafu )
0 commit comments