mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 15:14:08 +00:00
exapmles/app/errors.zig: remove unnecessary empty stubs
This commit is contained in:
parent
905b376c21
commit
6bdd5a41e4
1 changed files with 2 additions and 16 deletions
|
@ -14,7 +14,7 @@ const MyContext = struct {
|
||||||
db_connection: []const u8,
|
db_connection: []const u8,
|
||||||
|
|
||||||
// we don't use this
|
// we don't use this
|
||||||
pub fn unhandledRequest(_: *MyContext, _: Allocator, _: zap.Request) anyerror!void {}
|
// pub fn unhandledRequest(_: *MyContext, _: Allocator, _: zap.Request) anyerror!void {}
|
||||||
|
|
||||||
pub fn unhandledError(_: *MyContext, _: zap.Request, err: anyerror) void {
|
pub fn unhandledError(_: *MyContext, _: zap.Request, err: anyerror) void {
|
||||||
std.debug.print("\n\n\nUNHANDLED ERROR: {} !!! \n\n\n", .{err});
|
std.debug.print("\n\n\nUNHANDLED ERROR: {} !!! \n\n\n", .{err});
|
||||||
|
@ -46,14 +46,6 @@ const ErrorEndpoint = struct {
|
||||||
// -> error will be raised and dispatched to MyContext.unhandledError
|
// -> error will be raised and dispatched to MyContext.unhandledError
|
||||||
return error.@"Oh-No!";
|
return error.@"Oh-No!";
|
||||||
}
|
}
|
||||||
|
|
||||||
// empty stubs for all other request methods
|
|
||||||
pub fn post(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
pub fn put(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
pub fn delete(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
pub fn patch(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
pub fn options(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
pub fn head(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const StopEndpoint = struct {
|
const StopEndpoint = struct {
|
||||||
|
@ -69,12 +61,6 @@ const StopEndpoint = struct {
|
||||||
, .{context.*.db_connection});
|
, .{context.*.db_connection});
|
||||||
zap.stop();
|
zap.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn post(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
pub fn put(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
pub fn delete(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
pub fn patch(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
pub fn options(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
|
|
Loading…
Add table
Reference in a new issue