github.com/cockroachdb/cockroachdb-parser@v0.23.3-0.20240213214944-911057d40c9a/pkg/cli/exit/codes.go (about) 1 // Copyright 2020 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package exit 12 13 // Codes that are common to all command times (server + client) follow. 14 15 // Success (0) represents a normal process termination. 16 func Success() Code { return Code{0} } 17 18 // UnspecifiedError (1) indicates the process has terminated with an 19 // error condition. The specific cause of the error can be found in 20 // the logging output. 21 func UnspecifiedError() Code { return Code{1} } 22 23 // UnspecifiedGoPanic (2) indicates the process has terminated due to 24 // an uncaught Go panic or some other error in the Go runtime. 25 // 26 // The reporting of this exit code likely indicates a programming 27 // error inside CockroachDB. 28 // 29 // Conversely, this should not be used when implementing features. 30 func UnspecifiedGoPanic() Code { return Code{2} } 31 32 // Interrupted (3) indicates the server process was interrupted with 33 // Ctrl+C / SIGINT. 34 func Interrupted() Code { return Code{3} } 35 36 // CommandLineFlagError (4) indicates there was an error in the 37 // command-line parameters. 38 func CommandLineFlagError() Code { return Code{4} } 39 40 // LoggingStderrUnavailable (5) indicates that an error occurred 41 // during a logging operation to the process' stderr stream. 42 func LoggingStderrUnavailable() Code { return Code{5} } 43 44 // LoggingFileUnavailable (6) indicates that an error occurred 45 // during a logging operation to a file. 46 func LoggingFileUnavailable() Code { return Code{6} } 47 48 // FatalError (7) indicates that a logical error in the server caused 49 // an emergency shutdown. 50 func FatalError() Code { return Code{7} } 51 52 // TimeoutAfterFatalError (8) indicates that an emergency shutdown 53 // due to a fatal error did not occur properly due to some blockage 54 // in the logging system. 55 func TimeoutAfterFatalError() Code { return Code{8} } 56 57 // LoggingNetCollectorUnavailable (9) indicates that an error occurred 58 // during a logging operation to a network collector. 59 func LoggingNetCollectorUnavailable() Code { return Code{9} } 60 61 // DiskFull (10) indicates an emergency shutdown in response to a 62 // store's full disk. 63 func DiskFull() Code { return Code{10} } 64 65 // Killed (138) indicates the server process was terminated with SIGUSR1. 66 // 67 // Orchestration code should handle this exit code the same way it would handle 68 // the process being killed via SIGKILL. 69 func Killed() Code { return Code{138} } 70 71 // Codes that are specific to client commands follow. It's possible 72 // for codes to be reused across separate client or server commands. 73 // Command-specific exit codes should be allocated down from 125. 74 75 // 'doctor' exit codes. 76 77 // DoctorValidationFailed indicates that the 'doctor' command has detected 78 // an inconsistency in the SQL metaschema. 79 func DoctorValidationFailed() Code { return Code{125} }