@@ -28,9 +28,6 @@ pub enum SnmError {
28
28
#[ error( "Not found: {0}" ) ]
29
29
NotFoundResourceError ( String ) ,
30
30
31
- #[ error( "Not found package.json {0}" ) ]
32
- NotFoundPackageJsonError ( PathBuf ) ,
33
-
34
31
#[ error( "Package manager version not match, expected: {expected}, actual: {actual}" ) ]
35
32
NotMatchPackageManagerError {
36
33
raw_command : String ,
@@ -62,18 +59,12 @@ pub enum SnmError {
62
59
#[ error( "Parse package manager error , raw is {0}" ) ]
63
60
ParsePackageManagerError ( String ) ,
64
61
65
- #[ error( "Unsupported command: {raw_command}" ) ]
66
- UnsupportedCommandError { raw_command : String } ,
67
-
68
62
#[ error( "Duplicate lock file error" ) ]
69
63
DuplicateLockFileError { lock_file_vec : Vec < String > } ,
70
64
71
65
#[ error( "{stderr}" ) ]
72
66
SNMBinaryProxyFail { stderr : String } ,
73
67
74
- #[ error( "Cannot find command: {command}" ) ]
75
- CannotFindDefaultCommand { command : String } ,
76
-
77
68
#[ error( "Shasum error: {file_path} , expect: {expect} , actual: {actual}" ) ]
78
69
ShasumError {
79
70
file_path : String ,
@@ -87,55 +78,6 @@ pub enum SnmError {
87
78
88
79
pub fn friendly_error_message ( error : SnmError ) {
89
80
match error {
90
- SnmError :: BuildConfigError ( _) => {
91
- eprintln ! (
92
- r##"
93
- 👹 Build snm config error
94
-
95
- The following is a list of configurations supported by snm:
96
-
97
- SNM_STRICT:
98
-
99
- Whether to enable strict mode, default is false.
100
- In strict mode,
101
- Must be a .node-version file in current_dir and the correct version number configured.
102
- Must be a package.json in current_dir with the correct configuration of packageManager, for example: [email protected]
103
-
104
- SNM_NODE_BIN_DIR:
105
-
106
- The directory where the node binary is stored, default is node_bin.
107
-
108
- SNM_DOWNLOAD_DIR:
109
-
110
- The directory where the downloaded file is stored, default is downloads.
111
-
112
- SNM_NODE_MODULES_DIR:
113
-
114
- The directory where the node_modules is stored, default is node_modules.
115
-
116
- SNM_NODE_DIST_URL:
117
-
118
- The download address of the node binary, the default is https://nodejs.org/dist .
119
-
120
- SNM_GITHUB_RESOURCE_HOST:
121
-
122
- The download address of the node binary, the default is https://raw.githubusercontent.com .
123
-
124
- SNM_NODE_INSTALL_STRATEGY:
125
-
126
- The installation strategy of the node binary, the default is auto. You can choose ask, panic, auto.
127
-
128
- SNM_DOWNLOAD_TIMEOUT_SECS:
129
-
130
- The download timeout time, the default is 60s.
131
-
132
- SNM_PACKAGE_MANAGER_INSTALL_STRATEGY:
133
-
134
- The installation strategy of the package manager, the default is auto. You can choose ask, panic, auto.
135
-
136
- "##
137
- ) ;
138
- }
139
81
SnmError :: ParsePackageManagerError ( raw) => {
140
82
eprintln ! (
141
83
r##"
@@ -223,16 +165,6 @@ pub fn friendly_error_message(error: SnmError) {
223
165
actual. red( )
224
166
) ;
225
167
}
226
- SnmError :: UnsupportedCommandError { raw_command } => {
227
- eprintln ! (
228
- r##"
229
- 👹 You exec command is unsupported
230
-
231
- {}
232
- "## ,
233
- raw_command
234
- ) ;
235
- }
236
168
SnmError :: DuplicateLockFileError { lock_file_vec } => {
237
169
eprintln ! (
238
170
r##"
@@ -289,14 +221,13 @@ pub fn friendly_error_message(error: SnmError) {
289
221
) ;
290
222
}
291
223
SnmError :: HttpStatusCodeUnOk
292
- | SnmError :: NotFoundPackageJsonError ( _)
293
224
| SnmError :: GetWorkspaceError
294
225
| SnmError :: DeserializeError ( _)
295
226
| SnmError :: NetworkError ( _)
296
227
| SnmError :: DialoguerError ( _)
297
228
| SnmError :: VarError ( _)
298
- | SnmError :: CannotFindDefaultCommand { command : _ }
299
229
| SnmError :: ZipError ( _)
230
+ | SnmError :: BuildConfigError ( _)
300
231
| SnmError :: IOError ( _) => {
301
232
let msg = format ! ( "{}" , error. to_string( ) ) ;
302
233
// panic!("{msg}");
0 commit comments