Skip to content

Commit 229c7ef

Browse files
authored
Return non-zero exit code after error (#20)
1 parent 4458df4 commit 229c7ef

File tree

4 files changed

+38
-28
lines changed

4 files changed

+38
-28
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
ruby:
17-
- '3.0.2'
17+
- '3.0.6'
1818

1919
steps:
2020
- uses: actions/checkout@v4

Gemfile.lock

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
jekyll-kroki (0.3.0)
4+
jekyll-kroki (0.3.1)
55
faraday (~> 2.7)
66
faraday-retry (~> 2.2)
77
httpx (~> 1.1)
@@ -14,30 +14,30 @@ GEM
1414
addressable (2.8.6)
1515
public_suffix (>= 2.0.2, < 6.0)
1616
ast (2.4.2)
17-
base64 (0.2.0)
1817
colorator (1.1.0)
19-
concurrent-ruby (1.2.2)
18+
concurrent-ruby (1.2.3)
2019
em-websocket (0.5.3)
2120
eventmachine (>= 0.12.9)
2221
http_parser.rb (~> 0)
2322
eventmachine (1.2.7)
24-
faraday (2.7.12)
25-
base64
26-
faraday-net_http (>= 2.0, < 3.1)
27-
ruby2_keywords (>= 0.0.4)
28-
faraday-net_http (3.0.2)
23+
faraday (2.9.0)
24+
faraday-net_http (>= 2.0, < 3.2)
25+
faraday-net_http (3.1.0)
26+
net-http
2927
faraday-retry (2.2.0)
3028
faraday (~> 2.0)
3129
ffi (1.16.3)
3230
forwardable-extended (2.6.0)
33-
google-protobuf (3.25.1-x86_64-linux)
34-
http-2-next (1.0.1)
31+
google-protobuf (3.25.2-arm64-darwin)
32+
google-protobuf (3.25.2-x86_64-darwin)
33+
google-protobuf (3.25.2-x86_64-linux)
34+
http-2-next (1.0.3)
3535
http_parser.rb (0.8.0)
36-
httpx (1.1.5)
37-
http-2-next (>= 1.0.1)
36+
httpx (1.2.2)
37+
http-2-next (>= 1.0.3)
3838
i18n (1.14.1)
3939
concurrent-ruby (~> 1.0)
40-
jekyll (4.3.2)
40+
jekyll (4.3.3)
4141
addressable (~> 2.4)
4242
colorator (~> 1.0)
4343
em-websocket (~> 0.5)
@@ -68,11 +68,17 @@ GEM
6868
rb-fsevent (~> 0.10, >= 0.10.3)
6969
rb-inotify (~> 0.9, >= 0.9.10)
7070
mercenary (0.4.0)
71-
minitest (5.20.0)
72-
nokogiri (1.15.5-x86_64-linux)
71+
minitest (5.22.2)
72+
net-http (0.4.1)
73+
uri
74+
nokogiri (1.16.2-arm64-darwin)
7375
racc (~> 1.4)
74-
parallel (1.23.0)
75-
parser (3.2.2.4)
76+
nokogiri (1.16.2-x86_64-darwin)
77+
racc (~> 1.4)
78+
nokogiri (1.16.2-x86_64-linux)
79+
racc (~> 1.4)
80+
parallel (1.24.0)
81+
parser (3.3.0.5)
7682
ast (~> 2.4.1)
7783
racc
7884
pathutil (0.16.2)
@@ -84,14 +90,14 @@ GEM
8490
rb-fsevent (0.11.2)
8591
rb-inotify (0.10.1)
8692
ffi (~> 1.0)
87-
regexp_parser (2.8.3)
93+
regexp_parser (2.9.0)
8894
rexml (3.2.6)
8995
rouge (4.2.0)
90-
rubocop (1.58.0)
96+
rubocop (1.60.2)
9197
json (~> 2.3)
9298
language_server-protocol (>= 3.17.0)
9399
parallel (~> 1.10)
94-
parser (>= 3.2.2.4)
100+
parser (>= 3.3.0.2)
95101
rainbow (>= 2.2.2, < 4.0)
96102
regexp_parser (>= 1.8, < 3.0)
97103
rexml (>= 3.2.5, < 4.0)
@@ -101,17 +107,23 @@ GEM
101107
rubocop-ast (1.30.0)
102108
parser (>= 3.2.1.0)
103109
ruby-progressbar (1.13.0)
104-
ruby2_keywords (0.0.5)
105110
safe_yaml (1.0.5)
106111
sass-embedded (1.69.5)
107112
google-protobuf (~> 3.23)
108113
rake (>= 13.0.0)
114+
sass-embedded (1.69.5-arm64-darwin)
115+
google-protobuf (~> 3.23)
116+
sass-embedded (1.69.5-x86_64-darwin)
117+
google-protobuf (~> 3.23)
109118
terminal-table (3.0.2)
110119
unicode-display_width (>= 1.1.1, < 3)
111120
unicode-display_width (2.5.0)
121+
uri (0.13.0)
112122
webrick (1.8.1)
113123

114124
PLATFORMS
125+
arm64-darwin
126+
x86_64-darwin
115127
x86_64-linux
116128

117129
DEPENDENCIES
@@ -121,4 +133,4 @@ DEPENDENCIES
121133
rubocop (~> 1.21)
122134

123135
BUNDLED WITH
124-
2.2.33
136+
2.5.6

lib/jekyll/kroki.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ def render_diagram(connection, diagram_desc, language)
7676
begin
7777
response = connection.get("#{language}/svg/#{encode_diagram(diagram_desc.text)}")
7878
rescue Faraday::Error => e
79-
raise "'#{connection.url_prefix}' does not point to a valid Kroki instance" if e.response.nil?
80-
81-
raise e.response[:body]
79+
raise e.message
8280
end
8381
expected_content_type = "image/svg+xml"
8482
returned_content_type = response.headers[:content_type]
@@ -163,7 +161,7 @@ def exit(error, caller_index = 1)
163161
file, line_number, caller = e.backtrace[caller_index].split(":")
164162
caller = caller.tr("`", "'")
165163
warn %([jekyll-kroki] "#{error.message}" #{caller} on line #{line_number} of #{file}).red
166-
exec "echo ''"
164+
exec "exit 1"
167165
end
168166
end
169167
end

lib/jekyll/kroki/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module Jekyll
44
class Kroki
5-
VERSION = "0.3.0"
5+
VERSION = "0.3.1"
66
end
77
end

0 commit comments

Comments
 (0)