Skip to content

Commit 808eb82

Browse files
committed
Refactor session configuration and error handling: simplify session start/delete callbacks and improve exception handling in message verification
1 parent 9932976 commit 808eb82

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spec/spec_helper.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class UserSession
1111
property username : String? = "example"
1212
end
1313

14-
Session.configure do |c|
14+
Session.configure do
1515
c.on_started = ->(sid : String, data : Session::Databag) { puts "Session started - Id: #{sid} Username: #{data.username}" }
1616
c.on_deleted = ->(sid : String, data : Session::Databag) { puts "Session Revoke - Id: #{sid} Username: #{data.username}" }
1717
end

src/message/verifier.cr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ module Message
3535
if valid_message?(data.to_s, digest.to_s)
3636
String.new(decode(data.to_s))
3737
end
38-
rescue argument_error : ArgumentError
39-
return if argument_error.message =~ %r{invalid base64}
40-
raise argument_error
38+
rescue ex : ArgumentError
39+
return if ex.message =~ %r{invalid base64}
40+
raise ex
4141
end
4242

4343
def verify(signed_message : String) : String

0 commit comments

Comments
 (0)