Skip to content
Snippets Groups Projects
Commit c37f7566 authored by Ondrej Holy's avatar Ondrej Holy
Browse files

extractor: Do not include basename in error messages

Almost all error messages are currently prefixed by an archive
basename. This is redundant. The caller knows what file is being
extracted. Let's drop the basename from all the error messages...

https://gitlab.gnome.org/GNOME/gnome-autoar/-/merge_requests/34
parent c68c6795
Branches
Tags
No related merge requests found
......@@ -1654,17 +1654,15 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self)
r = libarchive_create_read_object (TRUE, self, &a);
if (r != ARCHIVE_OK) {
if (self->error == NULL)
self->error = autoar_common_g_error_new_a (a, self->source_basename);
self->error = autoar_common_g_error_new_a (a, NULL);
return;
} else if (archive_filter_count (a) <= 1){
/* If we only use raw format and filter count is one, libarchive will
* not do anything except for just copying the source file. We do not
* want this thing to happen because it does unnecesssary copying. */
if (self->error == NULL)
self->error = g_error_new (AUTOAR_EXTRACTOR_ERROR,
self->error = g_error_new_literal (AUTOAR_EXTRACTOR_ERROR,
NOT_AN_ARCHIVE_ERRNO,
"\'%s\': %s",
self->source_basename,
"not an archive");
return;
}
......@@ -1730,8 +1728,7 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self)
if (r != ARCHIVE_EOF) {
if (self->error == NULL) {
self->error =
autoar_common_g_error_new_a (a, self->source_basename);
self->error = autoar_common_g_error_new_a (a, NULL);
}
archive_read_free (a);
return;
......@@ -1739,10 +1736,8 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self)
if (self->files_list == NULL) {
if (self->error == NULL) {
self->error = g_error_new (AUTOAR_EXTRACTOR_ERROR,
self->error = g_error_new_literal (AUTOAR_EXTRACTOR_ERROR,
EMPTY_ARCHIVE_ERRNO,
"\'%s\': %s",
self->source_basename,
"empty archive");
}
archive_read_free (a);
......@@ -1880,8 +1875,7 @@ autoar_extractor_step_extract (AutoarExtractor *self) {
r = libarchive_create_read_object (self->use_raw_format, self, &a);
if (r != ARCHIVE_OK) {
if (self->error == NULL) {
self->error =
autoar_common_g_error_new_a (a, self->source_basename);
self->error = autoar_common_g_error_new_a (a, NULL);
}
archive_read_free (a);
return;
......@@ -2002,8 +1996,7 @@ autoar_extractor_step_extract (AutoarExtractor *self) {
if (r != ARCHIVE_EOF) {
if (self->error == NULL) {
self->error =
autoar_common_g_error_new_a (a, self->source_basename);
self->error = autoar_common_g_error_new_a (a, NULL);
}
archive_read_free (a);
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment