Skip to content

Commit

Permalink
Retain standard 500 status for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hopsoft committed Jan 4, 2024
1 parent 045de75 commit b1f77e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/turbo_boost/commands/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def initialize(message = "", **kwargs)

class PerformError < CommandError
def initialize(message = "Unexpected error in TurboBoost Command!", **kwargs)
super(message, http_status: :unhandled_turbo_boost_command_error, **kwargs)
super(message, http_status: :internal_server_error, **kwargs)
end
end
end
5 changes: 1 addition & 4 deletions lib/turbo_boost/commands/http_status_codes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

module TurboBoost::Commands
HTTP_ABORT_STATUS_CODE = 285 # I-285 is the most congested highway in the US (traffic jams → halt/abort)
HTTP_ERROR_STATUS_CODE = 595 # I-95 is the most dangerous highway in the US (fatal accidents → error)

HTTP_STATUS_CODES = Rack::Utils::HTTP_STATUS_CODES.merge(
HTTP_ABORT_STATUS_CODE => "Abort TurboBoost Command",
HTTP_ERROR_STATUS_CODE => "Unhandled TurboBoost Command Error"
HTTP_ABORT_STATUS_CODE => "Abort TurboBoost Command"
).freeze

def self.http_status_code(value)
Expand All @@ -15,7 +13,6 @@ def self.http_status_code(value)

case value.to_sym
when :abort_turbo_boost_command then HTTP_ABORT_STATUS_CODE
when :unhandled_turbo_boost_command_error then HTTP_ERROR_STATUS_CODE
else Rack::Utils::SYMBOL_TO_STATUS_CODE[value.to_sym]
end
end
Expand Down

0 comments on commit b1f77e1

Please sign in to comment.