clearer errors

Open Beginner friendly
#46 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
zig

Research direction

Reproduce the example with zig build build-lib:bindings, then inspect src/js/wrap_function.zig around line 180 where the convertArg: unsupported type bool error is reported. Improve the diagnostic so it identifies the user-facing function argument and the unsupported value more clearly, then rerun the build to confirm the resulting error.

Written by the indexing model from the issue text.

Description

Right now it's a bit devex unfriendly if you use a non js wrapped value as an arg to a function signature. For example:

pub fn foo(self: *const Bar, my_bool: bool)  !void { ... }

The error, when you try to build:

➜ zig build build-lib:bindings
build-lib:bindings
└─ install bindings
   └─ compile lib bindings Debug native 1 errors
zig-pkg/zapi-2.2.0-rIqzUXBaBADUsvvvB2N5kOBdLEO0rGPhowTqmIXe3qVh/src/js/wrap_function.zig:180:5: error: convertArg: unsupported type bool
    @compileError("convertArg: unsupported type " ++ @typeName(T));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

it does not tell you exactly where/what went wrong, but only something internally that went wrong, and unless you're familiar with zapi the error can be quite confusing.

Dominant language
Zig
Stars
4
Forks
4
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ChainSafe/zapi

All issues in ChainSafe/zapi

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.