err0

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 1 Imported by: 22

README

Introduction

The Repo API is from https://github.com/lainio/err2/tree/v0.9.1#error-checks

I like err2 old api, so I create this.

API

package main

import (
	"fmt"

	"github.com/shynome/err0"
	"github.com/shynome/err0/try"
)

func main() {
	var err error
	defer err0.Then(&err, func() {
		fmt.Println("no error", err)
	}, func() {
		fmt.Println("has error", err)
	})
	try.To(fmt.Errorf("hi, error!"))
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Throw = try.To

Functions

func Then added in v0.1.0

func Then(err *error, onok func(), onerr func())

Then only handle try.ToX panic generate error(try.Error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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