Skip to content

Commit

Permalink
implement side effects
Browse files Browse the repository at this point in the history
Also implement helper accessor functions
  • Loading branch information
muhamadazmy committed Mar 17, 2024
1 parent ec9ad33 commit fdd4717
Show file tree
Hide file tree
Showing 10 changed files with 622 additions and 28 deletions.
8 changes: 8 additions & 0 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ func (e *terminalError) Unwrap() error {

// WithErrorCode returns an error with specific
func WithErrorCode(err error, code Code) error {
if err == nil {
return nil
}

return &codeError{
inner: err,
code: code,
Expand All @@ -180,6 +184,10 @@ func WithErrorCode(err error, code Code) error {
// TerminalError returns a terminal error with optional code.
// code is optional but only one code is allowed.
func TerminalError(err error, code ...Code) error {
if err == nil {
return nil
}

if len(code) > 1 {
panic("only single code is allowed")
}
Expand Down
373 changes: 373 additions & 0 deletions generated/proto/javascript/javascript.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fdd4717

Please sign in to comment.