26 lines
805 B
Go
26 lines
805 B
Go
package apperror
|
|
|
|
import "errors"
|
|
|
|
type AppError struct {
|
|
Code string
|
|
Message string
|
|
}
|
|
|
|
func (e *AppError) Error() string {
|
|
return e.Message
|
|
}
|
|
|
|
var (
|
|
ErrMessageEmpty = &AppError{Code: "MSG_EMPTY", Message: "message text is empty"}
|
|
ErrRouteNotFound = &AppError{Code: "ROUTE_NOT_FOUND", Message: "no route found for message"}
|
|
ErrWorkflowTimeout = &AppError{Code: "WORKFLOW_TIMEOUT", Message: "workflow call timed out"}
|
|
ErrTranscriptionFailed = &AppError{Code: "TRANSCRIPTION_FAILED", Message: "voice transcription failed"}
|
|
ErrSessionNotFound = &AppError{Code: "SESSION_NOT_FOUND", Message: "session not found"}
|
|
ErrDownloadFailed = &AppError{Code: "DOWNLOAD_FAILED", Message: "file download failed"}
|
|
)
|
|
|
|
func Is(err, target error) bool {
|
|
return errors.Is(err, target)
|
|
}
|