samber / samber/oops

[Proposal] Add the log level to the error builder

Open
#42 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
990
Forks
45
Avg merge
5d 9h
Merged PRs (30d)
5

Description

What about adding a .Level(slog.Level) method to the error builder?

Pros:

  • When I build an error in a nested function, the caller cannot differentiate between an acceptable error (warning?) and a blocking error (error).
  • An HTTP status 404 is a warning while a 500 is an error, but both are considered errors by the HTTP frameworks.

Cons:

  • The log level is a logger thing, while this library provides an error builder. The separation of concern is not fully respected.

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.

Research direction

Review the error builder API and the proposal for a .Level(slog.Level) method. Resolve whether log-level state belongs in this library or the logger, and define the expected behavior for warning-like 404 errors versus blocking 500 errors before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.