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)
| 842 | // handleError handles err and returns an appropriate exit code. |
| 843 | // If browserErrors is non-nil, errors are written for presentation in browser. |
| 844 | func 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. |
| 862 | func printError(err error, options *gbuild.Options, browserErrors *bytes.Buffer) { |
no test coverage detected
searching dependent graphs…