Skip to content

Commit

Permalink
[ecosystem] Improve email form error handling. (aptos-labs#983)
Browse files Browse the repository at this point in the history
* Fix margin when fullnode_network_key has errors.

* Don't crash if user inputs an invalid email.
  • Loading branch information
zacharydenton authored May 13, 2022
1 parent 52b929a commit 440b17b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def email_update
else
render :email, status: :unprocessable_entity
end
rescue SendEmailJobError
current_user.errors.add :email
render :email, status: :unprocessable_entity
end

private
Expand Down
2 changes: 1 addition & 1 deletion ecosystem/platform/server/app/jobs/send_email_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def send_email
handle_results(results)
rescue StandardError => e
Sentry.capture_exception(e)
puts "Error: #{e}"
raise SendEmailJobError
end

def email_body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
<%= f.text_field :fullnode_address %>
</div>

<p class="mb-4">
<div class="mb-4">
<%= f.label :fullnode_network_key, class: "font-mono uppercase block mb-2 text-lg" %>
<%= f.text_field :fullnode_network_key, pattern: '0x[a-f0-9]{64}' %>
</p>
</div>

<div class="flex gap-8 md:gap-16 mb-4 items-end">
<div class="flex-1">
Expand Down

0 comments on commit 440b17b

Please sign in to comment.