« 编解码 :: 目录 :: http相关 »
目录
我们通常在处理错误时,会使用errno和errmsg来标示一个错误,这个包就是对这类错误的封装。
因为golang自身并没有异常机制,模拟该机制需要用到panic,我们认为异常和panic在设计上不应当混用,所以这里的exception对象也只是封装了errno和errmsg。
示例:
import ( "andals/gobox/exception" )
struct:
type Exception struct { errno int msg string } func New(errno int, msg string) *Exception func (this *Exception) Errno() int func (this *Exception) Msg() string func (this *Exception) Error() string