[feat] Custom Error Response with two different Error() functions

Open
#28 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start with the referenced github.go around line 770, then inspect Salt's existing error and logging entry points. The issue does not name project files or tests, so first identify where errors are created and returned. Done would require an agreed custom error design that provides separate user-facing and enhanced logging details.

Written by the indexing model from the issue text.

Description

enhancement

Is your feature request related to a problem? Please describe.
With the current exceptions message, it's hard to get understand which part of the service is failing like data-layer, logic-layer, calling another service etc.

Describe the solution you'd like
Clear and concise details of error so it could help to understand what is the problem.
https://github.com/google/go-github/blob/master/github/github.go#L770

Describe alternatives you've considered
Create a custom Error type to add details about caller, component, request body etc. This custom type will have two different implementations for Error() methods:

  • One implementation of the Error function will print the error message we want to display to end-users either as Api response or CLI response.
  • Other implementations of the Error function will print enhanced error details while we logged using logger.
Dominant language
Go
Stars
14
Forks
8
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 raystack/salt

All issues in raystack/salt

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.