Skip to content

Conversation

@sttk
Copy link
Owner

@sttk sttk commented Apr 24, 2025

This PR introduces the initial implementation of the errs module, a library for error handling in Golang.
Originally, it was intended to be provided as part of the Sabi framework. However, to better support use cases that require only this error handling, and to allow focused development on error handling features, it was separated into this own repository.

This PR contains the following two main implementations:

  1. Err struct which has a field that represents a reason of an error occurrence.
  2. The notification mechanism triggered upon a instantiation of an Err

@sttk sttk requested a review from Copilot April 24, 2025 03:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the initial implementation of the errs module for error handling in Go by defining an Err struct along with synchronous and asynchronous notification mechanisms. Key changes include:

  • Implementation of error registration and notification (notify.go, notify_not.go, notify_test.go).
  • Removal of obsolete hello examples (hello.go, hello_test.go).
  • Addition of comprehensive examples and tests (example_err_test.go, err.go).
  • Updates to GitHub workflows to use the appropriate build tags.

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
notify_test.go Adds tests for synchronous and asynchronous error handler registration and notifications.
notify_not.go Provides a stub implementation when the notify build tag is disabled.
notify.go Implements the error notification mechanism via handler lists.
hello_test.go / hello.go Removes outdated hello example code.
example_err_test.go Introduces examples to demonstrate usage of the errs module.
err.go Implements the Err struct and its methods for error handling.
.github/workflows/go.yml Updates build and test commands to include the proper build tag.
Files not reviewed (1)
  • build.sh: Language not supported
Comments suppressed due to low confidence (1)

notify_test.go:224

  • Relying on time.Sleep for synchronization in asynchronous error handler tests might lead to flaky behavior. Consider using a sync.WaitGroup or another synchronization mechanism to ensure async handlers complete before assertions.
time.Sleep(500 * time.Millisecond)

@sttk sttk merged commit 1d6ce3d into main Apr 24, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants