Fix error return trace propagation
This commit is contained in:
parent
ee7ff9e69a
commit
3cdd695948
1 changed files with 5 additions and 5 deletions
|
@ -335,12 +335,12 @@ pub fn Router(comptime Routes: type) type {
|
||||||
_ = next;
|
_ = next;
|
||||||
|
|
||||||
inline for (self.routes) |r| {
|
inline for (self.routes) |r| {
|
||||||
if (r.handle(req, res, ctx, {})) |_|
|
if (r.handle(req, res, ctx, {}))
|
||||||
// success
|
// success
|
||||||
return
|
return
|
||||||
else |err| switch (err) {
|
else |err| switch (err) {
|
||||||
error.RouteMismatch => {},
|
error.RouteMismatch => {},
|
||||||
else => return err,
|
else => |e| return e,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,10 +406,10 @@ pub const Route = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle(self: @This(), req: anytype, res: anytype, ctx: anytype, next: anytype) !void {
|
pub fn handle(self: @This(), req: anytype, res: anytype, ctx: anytype, next: anytype) !void {
|
||||||
return if (self.applies(req, ctx))
|
if (self.applies(req, ctx))
|
||||||
next.handle(req, res, ctx, {})
|
return next.handle(req, res, ctx, {})
|
||||||
else
|
else
|
||||||
error.RouteMismatch;
|
return error.RouteMismatch;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue