-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix exception output capturing #482
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,8 @@ def send_message(message) | |
@stdout.write("Content-Length: #{json_message.length}\r\n\r\n#{json_message}") | ||
end | ||
|
||
# Log a debug message to the editor's output | ||
def debug_message(message) | ||
# Log a message to the editor's output panel | ||
def log_message(message) | ||
$stderr.puts(message) | ||
end | ||
end | ||
|
@@ -119,12 +119,17 @@ def execute(request, params) | |
require params[:server_addon_path] | ||
ServerAddon.finalize_registrations!(@stdout) | ||
when "server_addon/delegate" | ||
server_addon_name = params.delete(:server_addon_name) | ||
request_name = params.delete(:request_name) | ||
ServerAddon.delegate(server_addon_name, request_name, params) | ||
server_addon_name = params[:server_addon_name] | ||
request_name = params[:request_name] | ||
ServerAddon.delegate(server_addon_name, request_name, params.except(:request_name, :server_addon_name)) | ||
end | ||
request_name = request | ||
request_name = "#{params[:server_addon_name]}##{params[:request_name]}" if request == "server_addon/delegate" | ||
# Since this is a common problem, we show a specific error message to the user, instead of the full stack trace. | ||
rescue ActiveRecord::ConnectionNotEstablished | ||
log_message("Request #{request_name} failed because database connection was not established.") | ||
rescue => e | ||
send_message({ error: e.full_message(highlight: false) }) | ||
log_message("Request #{request_name} failed:\n" + e.full_message(highlight: false)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vinistock I updated this so that we show the request name for both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
end | ||
|
||
private | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to avoid deleting the params here since they may be needed in the error message.