code.gitea.io/gitea@v1.19.3/modules/migration/error.go (about)

     1  // Copyright 2021 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package migration
     5  
     6  import "fmt"
     7  
     8  // ErrNotSupported represents status if a downloader do not supported something.
     9  type ErrNotSupported struct {
    10  	Entity string
    11  }
    12  
    13  // IsErrNotSupported checks if an error is an ErrNotSupported
    14  func IsErrNotSupported(err error) bool {
    15  	_, ok := err.(ErrNotSupported)
    16  	return ok
    17  }
    18  
    19  // Error return error message
    20  func (err ErrNotSupported) Error() string {
    21  	if len(err.Entity) != 0 {
    22  		return fmt.Sprintf("'%s' not supported", err.Entity)
    23  	}
    24  	return "not supported"
    25  }