mirror of
https://github.com/hanzoai/go-openai-realtime.git
synced 2026-09-30 21:54:42 +00:00
30 lines
517 B
Go
30 lines
517 B
Go
package openairt
|
|
|
|
// PermanentError signals that the operation should not be retried.
|
|
type PermanentError struct {
|
|
Err error
|
|
}
|
|
|
|
func (e *PermanentError) Error() string {
|
|
return e.Err.Error()
|
|
}
|
|
|
|
func (e *PermanentError) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
func (e *PermanentError) Is(target error) bool {
|
|
_, ok := target.(*PermanentError)
|
|
return ok
|
|
}
|
|
|
|
// Permanent wraps the given err in a *PermanentError.
|
|
func Permanent(err error) error {
|
|
if err == nil {
|
|
return nil
|
|
}
|
|
return &PermanentError{
|
|
Err: err,
|
|
}
|
|
}
|