# Error reporting feedback

**URL:** <https://ziggit.dev/t/error-reporting-feedback/17936>\
**Category:** Help\
**Tags:** language, testing, error-handling\
**Created:** [October 13, 2026, 6:01am UTC](https://ziggit.dev/t/error-reporting-feedback/17936 "2026-10-13T06:01:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nrv30](https://ziggit.dev/user_avatar/ziggit.dev/nrv30/32/10025_2.png) [@nrv30](https://ziggit.dev/u/nrv30)\
**Post date:** [October 13, 2026, 6:01am UTC](https://ziggit.dev/t/error-reporting-feedback/17936/1 "2026-10-13T06:01:01Z")

</div>

Full Code: [nrv30/int-base-converter: convert u64 between hex, octal, binary, decimal. My first zig project!](https://github.com/nrv30/int-base-converter)

I made a REPL program, so I print error messages to the user.

```zig
if (stdout_writer) |writer| {
    try writer.writeAll("Invalid Command. Missing '('\n");
    try writer.flush();
}
return error.InvalidCommand;

```

I have to check stdout\_writer is not null every time because I made it optional. The reason I did this is because I want to be able to pass the writer as null in my test code to avoid printing the error messages. I wanted to ask if there’s a better strategy because it feels a bit hacky.

It’s also being repeated many times, so I wanted to make it a helper function. However, I can’t figure out if there’s a way to signal that a function always returns an error. If I do `pub fn name() !void` it’s inaccurate because the function never returns nothing, it always returns an error.

I asked AI, it recommended me to use `@TypeOf(error.InvalidCommand)`. Do you guys agree with this advice? I found it kina confusing, but it looked like what I was trying to do.

Thanks!

---

<div class="post-metadata">

**Author:** ![vulpesx](https://ziggit.dev/user_avatar/ziggit.dev/vulpesx/32/3989_2.png) [@vulpesx](https://ziggit.dev/u/vulpesx)\
**Post date:** [October 13, 2026, 6:07am UTC](https://ziggit.dev/t/error-reporting-feedback/17936/2 "2026-10-13T06:07:45Z")

</div>

> [@nrv30](#):
>
> I want to be able to pass the writer as null in my test code to avoid printing the error messages. I wanted to ask if there’s a better strategy because it feels a bit hacky.

`std.Io.Writer.Discarding` :3

> [@nrv30](#):
>
> I can’t figure out if there’s a way to signal that a function always returns an error

```zig
fn foo() error{MyError} {
}

```

---

<div class="post-metadata">

**Author:** ![nrv30](https://ziggit.dev/user_avatar/ziggit.dev/nrv30/32/10025_2.png) [@nrv30](https://ziggit.dev/u/nrv30)\
**Post date:** [October 13, 2026, 7:05am UTC](https://ziggit.dev/t/error-reporting-feedback/17936/3 "2026-10-13T07:05:21Z")

</div>

Thank You. Now I remember error sets seeing this in the docs a lot 🤦‍♂️
