Skip to content

weberr13/errorable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

errorable

A Maybe Error structure for encapsulating errors on basic types

Borrowing from functional paradigms, encapsulate a maybe error idea into basic types

currently implements int and slice of int

For instance if you have a slice of strings that you want to convert to a slice of integers, but you want to account for possible conversion issues:

s := []string{"1","2","three"}

ei := NewIntErrs(strconv.Atoi,s)

will return ei where

ei.GetFirstErr() will return the error converting "three" and

ei.Get(0) == 1 ei.Get(1) == 2 ei.Get(2) == 0 (or whatever the default for Atoi is, if you care)

About

A Maybe Error structure for encapsulating errors on basic types

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages