forked from lobo/lambda-zig
		
	fix compile errors
This commit is contained in:
		
							parent
							
								
									3f33693d7a
								
							
						
					
					
						commit
						7b890d2458
					
				
					 1 changed files with 10 additions and 4 deletions
				
			
		|  | @ -101,8 +101,11 @@ pub fn run(event_handler: HandlerFn) !void { // TODO: remove inferred error set? | ||||||
|         } |         } | ||||||
|         const event_response = event_handler(req_allocator, resp_payload.items) catch |err| { |         const event_response = event_handler(req_allocator, resp_payload.items) catch |err| { | ||||||
|             // Stack trace will return null if stripped |             // Stack trace will return null if stripped | ||||||
|             const return_trace = @errorReturnTrace() orelse "no return trace available"; |             const return_trace = @errorReturnTrace(); | ||||||
|             std.log.err("Caught error: {}. Return Trace: {s}", .{ err, return_trace }); |             if (return_trace) |rt| | ||||||
|  |                 std.log.err("Caught error: {}. Return Trace: {any}", .{ err, rt }) | ||||||
|  |             else | ||||||
|  |                 std.log.err("Caught error: {}. No return trace available", .{err}); | ||||||
|             const err_url = try std.fmt.allocPrint(req_allocator, "{s}{s}/runtime/invocation/{s}/error", .{ prefix, lambda_runtime_uri, req_id }); |             const err_url = try std.fmt.allocPrint(req_allocator, "{s}{s}/runtime/invocation/{s}/error", .{ prefix, lambda_runtime_uri, req_id }); | ||||||
|             defer req_allocator.free(err_url); |             defer req_allocator.free(err_url); | ||||||
|             const err_uri = try std.Uri.parse(err_url); |             const err_uri = try std.Uri.parse(err_url); | ||||||
|  | @ -110,10 +113,13 @@ pub fn run(event_handler: HandlerFn) !void { // TODO: remove inferred error set? | ||||||
|                 \\  {s} |                 \\  {s} | ||||||
|                 \\    "errorMessage": "{s}", |                 \\    "errorMessage": "{s}", | ||||||
|                 \\    "errorType": "HandlerReturnedError", |                 \\    "errorType": "HandlerReturnedError", | ||||||
|                 \\    "stackTrace": [ "{s}" ] |                 \\    "stackTrace": [ "{any}" ] | ||||||
|                 \\  {s} |                 \\  {s} | ||||||
|             ; |             ; | ||||||
|             const content_fmt = try std.fmt.allocPrint(req_allocator, content, .{ "{", @errorName(err), return_trace, "}" }); |             const content_fmt = if (return_trace) |rt| | ||||||
|  |                 try std.fmt.allocPrint(req_allocator, content, .{ "{", @errorName(err), rt, "}" }) | ||||||
|  |             else | ||||||
|  |                 try std.fmt.allocPrint(req_allocator, content, .{ "{", @errorName(err), "no return trace available", "}" }); | ||||||
|             defer req_allocator.free(content_fmt); |             defer req_allocator.free(content_fmt); | ||||||
|             std.log.err("Posting to {s}: Data {s}", .{ err_url, content_fmt }); |             std.log.err("Posting to {s}: Data {s}", .{ err_url, content_fmt }); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue