FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ops-codegraph-tool/src/shared/errors.ts at main · Deriddle-Dev/ops-codegraph-tool · GitHub
Deriddle-Dev
/
ops-codegraph-tool
Public
forked from
optave/ops-codegraph-tool
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ops-codegraph-tool
/
src
/
shared
/
errors.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
85 lines (73 loc) · 2.47 KB
Breadcrumbs
ops-codegraph-tool
/
src
/
shared
/
errors.ts
Copy path
File metadata and controls
85 lines (73 loc) · 2.47 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
75
76
77
78
79
80
81
82
83
84
85
/**
* Domain error hierarchy for codegraph.
*
* Library code throws these instead of calling process.exit() or throwing
* bare Error instances. The CLI top-level catch formats them for humans;
* MCP returns structured { isError, code } responses.
*/
export
interface
CodegraphErrorOpts
{
code
?:
string
;
file
?:
string
;
cause
?:
Error
;
}
export
class
CodegraphError
extends
Error
{
code
:
string
;
file
:
string
|
undefined
;
constructor
(
message
:
string
,
{
code
=
'CODEGRAPH_ERROR'
,
file
,
cause
}
:
CodegraphErrorOpts
=
{
}
)
{
super
(
message
,
{
cause
}
)
;
this
.
name
=
'CodegraphError'
;
this
.
code
=
code
;
this
.
file
=
file
;
}
}
export
class
ParseError
extends
CodegraphError
{
constructor
(
message
:
string
,
opts
:
CodegraphErrorOpts
=
{
}
)
{
super
(
message
,
{
code
:
'PARSE_FAILED'
,
...
opts
}
)
;
this
.
name
=
'ParseError'
;
}
}
export
class
DbError
extends
CodegraphError
{
constructor
(
message
:
string
,
opts
:
CodegraphErrorOpts
=
{
}
)
{
super
(
message
,
{
code
:
'DB_ERROR'
,
...
opts
}
)
;
this
.
name
=
'DbError'
;
}
}
export
class
ConfigError
extends
CodegraphError
{
constructor
(
message
:
string
,
opts
:
CodegraphErrorOpts
=
{
}
)
{
super
(
message
,
{
code
:
'CONFIG_INVALID'
,
...
opts
}
)
;
this
.
name
=
'ConfigError'
;
}
}
export
class
ResolutionError
extends
CodegraphError
{
constructor
(
message
:
string
,
opts
:
CodegraphErrorOpts
=
{
}
)
{
super
(
message
,
{
code
:
'RESOLUTION_FAILED'
,
...
opts
}
)
;
this
.
name
=
'ResolutionError'
;
}
}
export
class
EngineError
extends
CodegraphError
{
constructor
(
message
:
string
,
opts
:
CodegraphErrorOpts
=
{
}
)
{
super
(
message
,
{
code
:
'ENGINE_UNAVAILABLE'
,
...
opts
}
)
;
this
.
name
=
'EngineError'
;
}
}
export
class
AnalysisError
extends
CodegraphError
{
constructor
(
message
:
string
,
opts
:
CodegraphErrorOpts
=
{
}
)
{
super
(
message
,
{
code
:
'ANALYSIS_FAILED'
,
...
opts
}
)
;
this
.
name
=
'AnalysisError'
;
}
}
export
class
BoundaryError
extends
CodegraphError
{
constructor
(
message
:
string
,
opts
:
CodegraphErrorOpts
=
{
}
)
{
super
(
message
,
{
code
:
'BOUNDARY_VIOLATION'
,
...
opts
}
)
;
this
.
name
=
'BoundaryError'
;
}
}
/** Safely extract a string message from an unknown thrown value. */
export
function
toErrorMessage
(
e
:
unknown
)
:
string
{
return
e
instanceof
Error
?
e
.
message
:
String
(
e
)
;
}
/**
* Catch-suppression helpers (`suppressError`, `suppressErrorAsync`) live in
* `infrastructure/suppress.ts` to avoid a shared→infrastructure layer inversion.
* Import them from there instead of from this module.
*/
Back
|
FazBrowse Home
|
New Git URL