summaryrefslogtreecommitdiffstats
path: root/modules/migrations/base/error.go
blob: 40ddcf4b75e92929af4ba89dc06bc0f5e753d22e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2021 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package base

import "fmt"

// ErrNotSupported represents status if a downloader do not supported something.
type ErrNotSupported struct {
	Entity string
}

// IsErrNotSupported checks if an error is an ErrNotSupported
func IsErrNotSupported(err error) bool {
	_, ok := err.(ErrNotSupported)
	return ok
}

// Error return error message
func (err ErrNotSupported) Error() string {
	if len(err.Entity) != 0 {
		return fmt.Sprintf("'%s' not supported", err.Entity)
	}
	return "not supported"
}