don't surface SQL error messages in graphql
test plan: - undo this fix locally: https://gerrit.instructure.com/c/canvas-lms/+/358062/6/app/models/conversation.rb - attempt to send a conversation message - the graphql call should result in a 500 error and the invalid SQL should show up in /error_reports and not the browser console flag=none closes FOO-4874 Change-Id: I78686a28ce3c99d2137f35423dbd81fe5e833658 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/360950 Reviewed-by: Keith Garner <kgarner@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: August Thornton <august@instructure.com> QA-Review: Jeremy Stanley <jeremy@instructure.com> Product-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
parent
97c62b2563
commit
330713980f
|
@ -39,7 +39,7 @@ module GraphQLPostgresTimeout
|
|||
end
|
||||
raise GraphQLPostgresTimeout::Error, "operation timed out"
|
||||
end
|
||||
raise GraphQL::ExecutionError, "Invalid SQL: #{e.message}"
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,5 +55,10 @@ describe "graphql pg statement_timeouts" do
|
|||
expect(result.dig("data", "updateAssignment")).to be_nil
|
||||
expect(result.dig("errors", 0, "path")).to eq ["updateAssignment"]
|
||||
end
|
||||
|
||||
it "does not surface other StatementInvalid exception details" do
|
||||
allow(Assignment).to receive(:find) { raise ActiveRecord::StatementInvalid, "not a timeout" }
|
||||
expect { CanvasSchema.execute(mutation, context: { current_user: @teacher }) }.to raise_error("not a timeout")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue