From d3fc21862ed98924e5aec308642308ebb41c7cb1 Mon Sep 17 00:00:00 2001 From: Robert Haines Date: Sat, 24 Feb 2024 07:20:17 +0000 Subject: [PATCH] Rename exceptions file to errors. --- lib/zip-container.rb | 2 +- lib/zip-container/container.rb | 5 ++--- lib/zip-container/{exceptions.rb => errors.rb} | 6 +++--- test/{exceptions_test.rb => errors_test.rb} | 2 +- test/reserved_names_test.rb | 8 ++++---- 5 files changed, 11 insertions(+), 12 deletions(-) rename lib/zip-container/{exceptions.rb => errors.rb} (93%) rename test/{exceptions_test.rb => errors_test.rb} (98%) diff --git a/lib/zip-container.rb b/lib/zip-container.rb index 730a6af..1ae6220 100644 --- a/lib/zip-container.rb +++ b/lib/zip-container.rb @@ -37,7 +37,7 @@ require 'zip-container/util' require 'zip-container/version' -require 'zip-container/exceptions' +require 'zip-container/errors' require 'zip-container/entries/reserved' require 'zip-container/entries/managed' require 'zip-container/entries/entry' diff --git a/lib/zip-container/container.rb b/lib/zip-container/container.rb index 0017e16..115a82b 100644 --- a/lib/zip-container/container.rb +++ b/lib/zip-container/container.rb @@ -109,9 +109,8 @@ def self.verify?(filename) # verify!(filename) # # Verify that the specified ZipContainer conforms to the specification. - # This method raises exceptions when errors are found or if there is - # something fundamental wrong with the container itself (e.g. it cannot be - # found). + # This method raises an error if there is something fundamental wrong + # with the container itself (e.g. it cannot be found). def self.verify!(filename) new(filename).verify! end diff --git a/lib/zip-container/exceptions.rb b/lib/zip-container/errors.rb similarity index 93% rename from lib/zip-container/exceptions.rb rename to lib/zip-container/errors.rb index e390315..b314e46 100644 --- a/lib/zip-container/exceptions.rb +++ b/lib/zip-container/errors.rb @@ -32,7 +32,7 @@ ## module ZipContainer - # The base of all exceptions raised by this library. + # The base of all errors raised by this library. module Error end @@ -40,7 +40,7 @@ module Error ZipError = ::Zip::Error ZipError.include Error - # This exception is raised when a bad Container is detected. + # This error is raised when a bad Container is detected. class MalformedContainerError < RuntimeError include Error @@ -63,7 +63,7 @@ def initialize(reason = nil) end end - # This exception is raised when a clash occurs with a reserved or managed + # This error is raised when a clash occurs with a reserved or managed # name. class ReservedNameClashError < RuntimeError include Error diff --git a/test/exceptions_test.rb b/test/errors_test.rb similarity index 98% rename from test/exceptions_test.rb rename to test/errors_test.rb index 0a06851..a3c2dc7 100644 --- a/test/exceptions_test.rb +++ b/test/errors_test.rb @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2023 The University of Manchester, UK. +# Copyright (c) 2014-2024 The University of Manchester, UK. # # All rights reserved. # diff --git a/test/reserved_names_test.rb b/test/reserved_names_test.rb index e2cebee..68fe0bc 100644 --- a/test/reserved_names_test.rb +++ b/test/reserved_names_test.rb @@ -153,7 +153,7 @@ def test_replace_mimetype end end - # Check that an exception is raised when trying to add file with a reserved + # Check that an error is raised when trying to add file with a reserved # name. def test_add_reserved ZipContainer::File.open(EMPTY_CNTR) do |c| @@ -163,7 +163,7 @@ def test_add_reserved end end - # Check that an exception is raised when trying to add file with a reserved + # Check that an error is raised when trying to add file with a reserved # name to a subclassed container. def test_subclass_add_reserved NewZipContainer.open(EMPTY_CNTR) do |c| @@ -205,7 +205,7 @@ def test_rename_metainf end end - # Check that an exception is raised when trying to create a directory with a + # Check that an error is raised when trying to create a directory with a # reserved name. def test_mkdir_reserved ZipContainer::File.open(EMPTY_CNTR) do |c| @@ -215,7 +215,7 @@ def test_mkdir_reserved end end - # Check that an exception is raised when trying to create a directory with a + # Check that an error is raised when trying to create a directory with a # reserved name in a subclassed container. def test_subclass_mkdir_reserved NewZipContainer.open(EMPTY_CNTR) do |c|