@@ -9,8 +9,7 @@ use std::path::PathBuf;
9
9
use std:: sync:: Arc ;
10
10
11
11
use crate :: keypair:: { get_keypair_path, get_payer} ;
12
- use crate :: config:: { TapeConfig , TapeConfigError } ;
13
- use crate :: log;
12
+ use crate :: config:: TapeConfig ;
14
13
15
14
#[ derive( Parser ) ]
16
15
#[ command(
@@ -243,64 +242,7 @@ impl Context{
243
242
pub fn try_build ( cli : & Cli ) -> Result < Self > {
244
243
245
244
// loading up configs
246
- let config = match TapeConfig :: load ( & cli. config ) {
247
- Ok ( config) => config,
248
- Err ( e) => match e {
249
- TapeConfigError :: ConfigFileNotFound => {
250
- log:: print_info ( "tape.toml not found, creating default configuration..." ) ;
251
- match TapeConfig :: create_default ( ) {
252
- Ok ( config) => {
253
- log:: print_info ( "✓ Default configuration created successfully" ) ;
254
- config
255
- } ,
256
- Err ( creation_error) => {
257
- log:: print_error ( & format ! ( "{}" , creation_error) ) ;
258
- std:: process:: exit ( 1 ) ;
259
- }
260
- }
261
- } ,
262
-
263
- TapeConfigError :: CustomConfigFileNotFound ( path) => {
264
- // This happens when user explicitly provided a path that doesn't exist
265
- log:: print_error ( & format ! ( "Custom config file not found: {}" , path) ) ;
266
- log:: print_info ( "Please check the path and try again." ) ;
267
- std:: process:: exit ( 1 ) ;
268
- } ,
269
-
270
- TapeConfigError :: InvalidUrl ( msg) => {
271
- log:: print_error ( & format ! ( "URL Configuration Error: {}" , msg) ) ;
272
- log:: print_info ( "Please fix the URL in your tape.toml file and try again." ) ;
273
- std:: process:: exit ( 1 ) ;
274
- } ,
275
-
276
- TapeConfigError :: KeypairNotFound ( path) => {
277
- log:: print_error ( & format ! ( "Keypair not found at path: {}" , path) ) ;
278
- log:: print_info ( "Please ensure the keypair file exists at the specified path in tape.toml" ) ;
279
- std:: process:: exit ( 1 ) ;
280
- } ,
281
-
282
- TapeConfigError :: FileReadError ( io_err) => {
283
- log:: print_error ( & format ! ( "Could not read config file: {}" , io_err) ) ;
284
- std:: process:: exit ( 1 ) ;
285
- } ,
286
-
287
- TapeConfigError :: ParseError ( parse_err) => {
288
- log:: print_error ( & format ! ( "Invalid tape.toml format: {}" , parse_err) ) ;
289
- log:: print_info ( "Please check your tape.toml file syntax." ) ;
290
- std:: process:: exit ( 1 ) ;
291
- } ,
292
-
293
- TapeConfigError :: HomeDirectoryNotFound => {
294
- log:: print_error ( "Could not determine home directory" ) ;
295
- std:: process:: exit ( 1 ) ;
296
- } ,
297
-
298
- TapeConfigError :: DefaultConfigCreationFailed ( msg) => {
299
- log:: print_error ( & format ! ( "Failed to create default config: {}" , msg) ) ;
300
- std:: process:: exit ( 1 ) ;
301
- } ,
302
- }
303
- } ;
245
+ let config = TapeConfig :: load ( & cli. config ) ?;
304
246
305
247
let rpc_url = config. solana . rpc_url . to_string ( ) ;
306
248
let commitment_level = config. solana . commitment . to_commitment_config ( ) ;
0 commit comments