NewWithOption creates and returns a custom error with Option. It is the senior usage for creating error, which is often used internally in framework.
(option Option)
| 20 | // NewWithOption creates and returns a custom error with Option. |
| 21 | // It is the senior usage for creating error, which is often used internally in framework. |
| 22 | func NewWithOption(option Option) error { |
| 23 | err := &Error{ |
| 24 | error: option.Error, |
| 25 | text: option.Text, |
| 26 | args: option.Args, |
| 27 | code: option.Code, |
| 28 | } |
| 29 | if option.Stack { |
| 30 | err.stack = callers() |
| 31 | } |
| 32 | return err |
| 33 | } |
| 34 | |
| 35 | // NewOption creates and returns a custom error with Option. |
| 36 | // |
searching dependent graphs…