Skip to content
Snippets Groups Projects
Select Git revision
  • b510ea8f56cdf87ed57fec4bf2cb8720d996597f
  • master default protected
  • 1.2.4
  • 1.2.3
  • 1.2.2
  • 1.2.1
  • 1.2.0
  • v1.1.0
8 results

state_exit.go

Blame
  • Volker Schukai's avatar
    3a97d95f
    History
    state_exit.go 479 B
    package environment
    
    import (
    	"gitlab.schukai.com/oss/utilities/documentation-manager/translations"
    	"os"
    )
    
    const ExitWithCodeSymbol = "exit with code"
    
    func (e *stateStruct) Exit() {
    	PrintMessages()
    	panic(ExitWithCodeSymbol)
    }
    
    func Exit() {
    
    	for _, fkt := range Handlers.Shutdown {
    		f := *fkt
    		f()
    	}
    
    	os.Exit(State.exitCode)
    }
    
    func ExitWithError(code int, message string, a ...interface{}) {
    	State.SetCode(code).AddError(translations.T.Sprintf(message, a)).Exit()
    }