jobparser 0.13.2 → 0.13.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/jobparser.rb CHANGED
@@ -16,6 +16,7 @@ require "jobparser/facets/location"
16
16
  require "jobparser/facets/apply"
17
17
  require "jobparser/facets/title"
18
18
  require "jobparser/facets/deadline"
19
+ require "jobparser/error"
19
20
 
20
21
  require "open-uri"
21
22
 
@@ -36,12 +37,17 @@ module JobParser
36
37
  end
37
38
  else
38
39
  # we only need the HTML if there's no cache
39
- html = open(url, :allow_redirections => :safe).read
40
- if html.include?("http://schema.org/JobPosting")
41
- ParseSchema.new(html, url)
42
- else
43
- ParseHtml.new(html, url)
40
+ begin
41
+ html = open(url, :allow_redirections => :safe).read
42
+ if html.include?("http://schema.org/JobPosting")
43
+ ParseSchema.new(html, url)
44
+ else
45
+ ParseHtml.new(html, url)
46
+ end
47
+ rescue URI::InvalidURIError
48
+ raise JobParser::Error::InvalidUrl, "The URI given was not valid"
44
49
  end
50
+
45
51
  end
46
52
 
47
53
  end
@@ -0,0 +1,6 @@
1
+ module JobParser
2
+ module Error
3
+ class InvalidUrl < Exception
4
+ end
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module JobParser
2
- VERSION = "0.13.2"
2
+ VERSION = "0.13.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.2
4
+ version: 0.13.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-12 00:00:00.000000000 Z
12
+ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -150,6 +150,7 @@ files:
150
150
  - lib/jobparser/cache/textfile.rb
151
151
  - lib/jobparser/cache.rb
152
152
  - lib/jobparser/cleaner.rb
153
+ - lib/jobparser/error.rb
153
154
  - lib/jobparser/facets/apply.rb
154
155
  - lib/jobparser/facets/deadline.rb
155
156
  - lib/jobparser/facets/facet.rb