lib/usps_flags.rb in usps_flags-0.2.6 vs lib/usps_flags.rb in usps_flags-0.3.0
- old
+ new
@@ -10,10 +10,11 @@
require 'usps_flags/config'
require 'usps_flags/helpers'
require 'usps_flags/core'
require 'usps_flags/generate'
+ require 'usps_flags/errors'
# Dir['./lib/usps_flags/core/**'].map { |d| d.split("/").last.split(".rb").first }
%w[anchor binoculars ensign field footer headers lighthouse pennant star trident tridents trident_spec trumpet us wheel].each do |d|
require "usps_flags/core/#{d}"
end
@@ -102,10 +103,10 @@
#
# Requires the constructor to have a value for png_file.
#
# @return [String] Returns the SVG file output path.
def png
- raise "Error: png_file must be set." if self.png_file.nil?
+ raise USPSFlags::Errors::PNGGenerationError, "A path must be set with png_file." if self.png_file.nil?
svg_file_storage = self.svg_file
self.svg_file ""
USPSFlags::Generate.png(self.svg, outfile: self.png_file, trim: self.trim)
self.svg_file svg_file_storage
self.png_file