error-handling 1.1 → 1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/error-handling.rb +26 -0
  2. metadata +1 -1
@@ -79,4 +79,30 @@ class Error
79
79
  end
80
80
  return
81
81
  end
82
+
83
+ def load(file_name)
84
+ #varify the file does inface exist
85
+ if File.file?(file_name)
86
+
87
+ #open error file and read each line.
88
+ File.open(file_name, "r").each do |file_line|
89
+
90
+ #split the items to push individually into the errors array
91
+ error_split = file_line.split(" ")
92
+
93
+ #push errors into the $stored_errors array
94
+ $stored_errors.push([error_split[1].chop, error_split[2], error_split[0].slice(1..-1).chop])
95
+ end
96
+ else
97
+ puts("Load error: \"" + file_name + "\" does not exist.")
98
+ end
99
+ end
100
+
101
+ def search(error_type)
102
+ $stored_errors.each{ |error|
103
+ if error[0] == error_type
104
+ puts("[" + error[2] + "] " + error[0] + ": " + error[1])
105
+ end
106
+ }
107
+ end
82
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: error-handling
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: