Skip to content

Commit 1160e88

Browse files
committed
async block ruturns Result for better error handling
1 parent bcb4e64 commit 1160e88

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/info.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -334,35 +334,35 @@ impl Info {
334334
Language::get_dominant_language(languages_stats.clone())
335335
);
336336

337-
let conf = config.unwrap();
338-
Info {
337+
let conf = config?;
338+
Ok(Info {
339339
git_version: git_v,
340340
git_username: git_user,
341341
project_name: conf.repository_name,
342-
current_commit: current_commit_info.unwrap(),
343-
version: version.unwrap(),
344-
creation_date: creation_date.unwrap(),
342+
current_commit: current_commit_info?,
343+
version: version?,
344+
creation_date: creation_date?,
345345
dominant_language,
346346
languages: languages_stats,
347347
authors,
348-
last_change: last_change.unwrap(),
348+
last_change: last_change?,
349349
repo: conf.repository_url,
350-
commits: commits.unwrap(),
351-
pending: pending.unwrap(),
352-
repo_size: repo_size.unwrap(),
350+
commits: commits?,
351+
pending: pending?,
352+
repo_size: repo_size?,
353353
number_of_lines,
354-
license: project_license.unwrap(),
354+
license: project_license?,
355355
custom_logo: logo,
356356
custom_colors: colors,
357357
disable_fields: disabled,
358358
bold_enabled: bold_flag,
359359
no_color_blocks: color_blocks_flag,
360360
custom_image,
361361
image_backend,
362-
}
362+
})
363363
};
364364

365-
let info = block_on(info);
365+
let info = block_on(info)?;
366366
Ok(info)
367367
}
368368

0 commit comments

Comments
 (0)