Skip to content

Commit

Permalink
Normalize the error outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
yanecc committed May 11, 2024
1 parent 7a483ab commit c0d4466
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/mockgpt/commands.cr
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ module Commands
puts "Upgrade succeeded!"
else
File.rename(tempPath, exePath)
STDERR.puts "Upgrade failed. Please try again."
exit 1
abort "Upgrade failed. Please try again."
end
{% else %}
url = "https://github.com/yanecc/MockGPT/releases/download/latest/mockgpt-"
Expand Down Expand Up @@ -70,8 +69,7 @@ module Commands
{% else %}
File.delete tempPath if File.exists? tempPath
{% end %}
STDERR.puts "Upgrade failed. Please try again."
exit 1
abort "Upgrade failed. Please try again."
end
{% end %}
end
Expand Down
2 changes: 1 addition & 1 deletion src/mockgpt/options.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ OptionParser.parse do |parser|
parser.unknown_args do |args, _|
if args.size > 2
STDERR.puts "Too many arguments: #{args}", parser
exit(1)
exit 1
end
case args[0]? || "all"
when "all"
Expand Down
3 changes: 1 addition & 2 deletions src/mockgpt/utils.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ module Utils
if response.status_code == 200
return response.body.to_s.match(pattern).try &.[1] || abort "Failed to match available versions."
else
puts "Failed to get latest version: #{response.status_message}"
exit(1)
abort "Failed to get latest version: #{response.status_message}"
end
end

Expand Down

0 comments on commit c0d4466

Please sign in to comment.