github.com/goplus/igop@v0.25.0/errors.go (about)

     1  /*
     2   * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved.
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  package igop
    18  
    19  import (
    20  	"errors"
    21  	"fmt"
    22  )
    23  
    24  var (
    25  	ErrNotFoundMain    = errors.New("not found main package")
    26  	ErrTestFailed      = errors.New("test failed")
    27  	ErrNotFoundPackage = errors.New("not found package")
    28  	ErrGoexitDeadlock  = errors.New("fatal error: no goroutines (main called runtime.Goexit) - deadlock!")
    29  	ErrNoFunction      = errors.New("no function")
    30  	ErrNoTestFiles     = errors.New("[no test files]")
    31  )
    32  
    33  type ExitError int
    34  
    35  func (r ExitError) Error() string {
    36  	return fmt.Sprintf("exit %v", int(r))
    37  }
    38  
    39  type plainError string
    40  
    41  func (e plainError) RuntimeError() {}
    42  
    43  func (e plainError) Error() string {
    44  	return string(e)
    45  }
    46  
    47  type runtimeError string
    48  
    49  func (e runtimeError) RuntimeError() {}
    50  
    51  func (e runtimeError) Error() string {
    52  	return "runtime error: " + string(e)
    53  }