Skip to content

Commit f1bd285

Browse files
author
rodolpheh
committed
Make wget more Zig-ish
1 parent a45d5cd commit f1bd285

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/zemscripten.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ pub fn log(
202202
extern fn emscripten_wget(url: [*c]const u8, file: [*c]const u8) c_int;
203203
extern fn emscripten_wget_data(url: [*c]const u8, pbuffer: **anyopaque, pnum: *c_int, perror: *c_int) void;
204204

205-
pub fn wget(url: [:0]const u8, file: [:0]const u8) c_int {
206-
return emscripten_wget(url.ptr, file.ptr);
205+
pub fn wget(url: [:0]const u8, file: [:0]const u8) !void {
206+
if (emscripten_wget(url.ptr, file.ptr) != 0) {
207+
return error.WgetError;
208+
}
207209
}
208210

209211
pub fn wget_data(url: [:0]const u8) ![]u8 {

0 commit comments

Comments
 (0)