From 6bdd5a41e45facca82f6c0bb3a5c5fb824652e6f Mon Sep 17 00:00:00 2001 From: renerocksai Date: Wed, 23 Jul 2025 19:00:06 +0200 Subject: [PATCH] exapmles/app/errors.zig: remove unnecessary empty stubs --- examples/app/errors.zig | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/examples/app/errors.zig b/examples/app/errors.zig index 5b9a89e..ab77eae 100644 --- a/examples/app/errors.zig +++ b/examples/app/errors.zig @@ -14,7 +14,7 @@ const MyContext = struct { db_connection: []const u8, // 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 { 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 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 { @@ -64,17 +56,11 @@ const StopEndpoint = struct { std.debug.print( \\Before I stop, let me dump the app context: \\db_connection='{s}' - \\ + \\ \\ , .{context.*.db_connection}); 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 {