Change all `log_write` by `metacall_throw_error`

Open
#720 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Sukuna0007Abhi is already working on this.

Since Mar 24, 2026.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, cpp
Domain
backend

Research direction

Start by reviewing the repeated log_write and metacall_error_throw pattern shown in the issue, along with the linked pull-request discussion. Search the core codebase for log_write calls involving value errors and determine which should use metacall_error_throw; done means the relevant cases avoid duplicated logging while preserving the proposed debug-build behavior.

Written by the indexing model from the issue text.

Description

We should start to use this type of error in the cases that values are involved.

		if (i < (int64_t)LONG_MIN || i > (int64_t)LONG_MAX)
		{
			log_write("metacall", LOG_LEVEL_ERROR, "64-bit signed integer value overflows long in RapidJSON implementation");
			return (value)metacall_error_throw("RapidJSON", -1, NULL, "64-bit signed integer value overflows long in RapidJSON implementation");
		}

But I have also noticed that the log pattern is getting repeated. Another step towards this would be to put the log_write inside the metacall_error_throw only for when compiling in debug.

https://github.com/metacall/core/pull/667#discussion_r2981781391

Dominant language
C
Stars
1.8k
Forks
266
Avg merge
2d 16h
Merged PRs (30d)
14

Getting set up

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 metacall/core

All issues in metacall/core

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.