FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cli/src/Support/ExitCode.php at main · durable-workflow/cli · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
durable-workflow
/
cli
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cli
/
src
/
Support
/
ExitCode.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
74 lines (56 loc) · 1.98 KB
Breadcrumbs
cli
/
src
/
Support
/
ExitCode.php
Copy path
File metadata and controls
74 lines (56 loc) · 1.98 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
declare
(strict_types=
1
);
namespace
DurableWorkflow
\
Cli
\
Support
;
/**
* Stable exit codes for the `dw` CLI.
*
* Scripts and CI pipelines rely on these values. Symfony Console's 0/1/2
* remain canonical for success, failure, and usage; dw extends that with
* specific codes for common server-driven outcomes so callers can react
* to auth, not-found, network, and server-side conditions without
* parsing stderr.
*/
final
class
ExitCode
{
/** Operation completed successfully. */
public
const
SUCCESS
=
0
;
/** Generic failure — command ran but did not succeed. */
public
const
FAILURE
=
1
;
/** Invalid usage — bad arguments, unknown options, or local validation. */
public
const
INVALID
=
2
;
/** Network failure — could not reach the server (connection refused, DNS, TLS, etc.). */
public
const
NETWORK
=
3
;
/** Authentication or authorization failure — HTTP 401 or 403. */
public
const
AUTH
=
4
;
/** Resource not found — HTTP 404. */
public
const
NOT_FOUND
=
5
;
/** Server error — HTTP 5xx or an unexpected server response. */
public
const
SERVER
=
6
;
/** Request timed out — the server did not respond within the deadline. */
public
const
TIMEOUT
=
7
;
/** Compatibility failure — the CLI/server protocol window cannot be used safely. */
public
const
COMPATIBILITY
=
8
;
private
function
__construct
() {}
/**
* Map an HTTP status code to its canonical exit code.
*/
public
static
function
fromHttpStatus
(
int
$
status
):
int
{
if
(
$
status
===
401
||
$
status
===
403
) {
return
self
::
AUTH
;
}
if
(
$
status
===
404
) {
return
self
::
NOT_FOUND
;
}
if
(
$
status
===
408
) {
return
self
::
TIMEOUT
;
}
if
(
$
status
>=
500
&&
$
status
<=
599
) {
return
self
::
SERVER
;
}
if
(
$
status
>=
400
&&
$
status
<=
499
) {
return
self
::
INVALID
;
}
return
self
::
FAILURE
;
}
}
Back
|
FazBrowse Home
|
New Git URL