ecerror

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 1 Imported by: 17

Documentation

Overview

Example
package main

import (
	"errors"
	"fmt"

	"github.com/suzuki-shunsuke/go-error-with-exit-code/ecerror"
)

func createUser() error {
	err := errors.New("user name is required")
	return ecerror.Wrap(err, 100)
}

func main() {
	err := createUser()
	fmt.Printf("The exit code is %d\n", ecerror.GetExitCode(err))
}
Output:

The exit code is 100

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExitCode

func GetExitCode(err error) int

func Wrap

func Wrap(err error, code int) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL