Skip to content
Discussion options

You must be logged in to vote

In general, we intentionally do not support custom pass-by-value types. All custom types must be pass-by-reference. This includes custom Error subclasses.

The reason for this is because custom serializable types have proven to be a security disaster in Java and other languages. It's just too easy to create a custom serializable type which inadvertently allows an attacker to trick the remote party into doing unsafe things, by sending an instance of that type when it isn't expected.

What we can do, though, is:

  • Override error.name to match the custom type ("AuthenticationFailedError") even if the class becomes just Error.
  • Serialize any additional own properties placed on the error object, s…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@joostn
Comment options

@kentonv
Comment options

Answer selected by joostn
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants