authgear / authgear/authgear-server

Refactor api error

Open
#4,074 3 comments 0 reactions 0 assignees View on GitHub
bug bug/minor
Dominant language
Go
Stars
2k
Forks
125
Avg merge
2d 17h
Merged PRs (30d)
32

Description

## Problem 1: The presence of skyerr and APIError ✅

Remove skyerr and use APIError

## Problem 2: APIError is not errors friendly

For example, APIError does not Unwrap, nor it supports [errors.Is](http://errors.Is). This causes us to use custom functions like apierrors.IsKind or IsRateLimitErrorWithBucketName to compare error. Example of bugs: [https://github.com/authgear/authgear-server/commit/6b660e8eb60572ddc5b1d089a912be051dc15823](https://github.com/authgear/authgear-server/commit/6b660e8eb60572ddc5b1d089a912be051dc15823)

## Problem 3: some features in errorutil duplicate with errors

For example, errorutil.Unwrap, which can be replaced by [errors.Is](http://errors.Is) and [errors.As](http://errors.As). errorutil.WithSecondaryError, which can be replaced by errors.Join.

Contributor guide

Open the contributing guide

Research direction

Start by tracing usages of skyerr, APIError, and errorutil across the repository, then review the linked commit for the stated comparison bug. The work is done when skyerr is removed, APIError supports standard error inspection, and duplicated errorutil features are addressed without breaking callers.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend-api-design
Issue type
Refactor
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.