Skip to content

Add SecureCookie.Err for surfacing deferred configuration errors#92

Open
c-tonneslan wants to merge 1 commit into
gorilla:mainfrom
c-tonneslan:add-err-method
Open

Add SecureCookie.Err for surfacing deferred configuration errors#92
c-tonneslan wants to merge 1 commit into
gorilla:mainfrom
c-tonneslan:add-err-method

Conversation

@c-tonneslan
Copy link
Copy Markdown

Closes #89. New stores configuration errors (no hash key, bad block key, etc.) on the returned SecureCookie but only surfaces them when Encode / Decode is later called. There's no way to fail fast at setup time without trying to encode a dummy value.

Add a tiny Err() accessor that returns the stored error. Encode and Decode are unchanged; this is purely additive.

Closes #89

New stores configuration errors (missing hash key, bad block key,
etc.) on the returned SecureCookie and only returns them later
from Encode or Decode. Callers that want to fail fast had no way
to read that state.

Add an Err accessor that returns the stored error, leaving the
existing Encode/Decode behavior unchanged.

Closes gorilla#89

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Silent errors on New()

1 participant