MCPcopy
hub / github.com/gopherjs/gopherjs / handleError

Function handleError

tool.go:844–859  ·  view source on GitHub ↗

handleError handles err and returns an appropriate exit code. If browserErrors is non-nil, errors are written for presentation in browser.

(err error, options *gbuild.Options, browserErrors *bytes.Buffer)

Source from the content-addressed store, hash-verified

842// handleError handles err and returns an appropriate exit code.
843// If browserErrors is non-nil, errors are written for presentation in browser.
844func handleError(err error, options *gbuild.Options, browserErrors *bytes.Buffer) int {
845 switch err := err.(type) {
846 case nil:
847 return 0
848 case errlist.ErrorList:
849 for _, entry := range err {
850 printError(entry, options, browserErrors)
851 }
852 return 1
853 case *exec.ExitError:
854 return err.Sys().(syscall.WaitStatus).ExitStatus()
855 default:
856 printError(err, options, browserErrors)
857 return 1
858 }
859}
860
861// printError prints err to Stderr with options. If browserErrors is non-nil, errors are also written for presentation in browser.
862func printError(err error, options *gbuild.Options, browserErrors *bytes.Buffer) {

Callers 2

mainFunction · 0.85
OpenMethod · 0.85

Calls 2

printErrorFunction · 0.85
SysMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…