Skip to content

Instantly share code, notes, and snippets.

@PxyUp
Created February 19, 2019 21:55
Show Gist options
  • Save PxyUp/34b47e44e8de863aa1a65537f57dfdb1 to your computer and use it in GitHub Desktop.
Save PxyUp/34b47e44e8de863aa1a65537f57dfdb1 to your computer and use it in GitHub Desktop.
Proposal of catch error

I like proposal with:

  • #name - invoke a handler by name
  • catch name {...} - define a handler

It solved many situations, but i think can be improved with panic and return state, like in proposal:

func returnError() error {
    return errors.New()
}
#*   := returnError()    // alias return error
#!   := returnError()    // alias panic(error)

Because it is will be decreased user code(user need write this manual) in all situations, and code will be clear and understandable, and this will solve error tracing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment