# SSO errors and events ## Definitions ### 'Recognised' errors Recognised errors are those with a `.code` property for which a special switch case has been written in the app code. Note: client (i.e. Google lib) errors are handled separately from server (i.e. call to the backend) errors; they just both happen to define a `.code` property. ## Spec ### Errors (user-visible error messages) For user-visible errors, we do not show client errors except for recognised errors, for which we show a hardcoded error message associated with that error. All others will yield a generic 'unidentified' error message of _"An unidentified error occurred. Please try again."_. We show _all_ server errors, trusting that the server will do the sanitisation itself (if this fails, it's easier to fix it on the server than it would be to add a new 'recognised' error on the client). Note: A server error must have a `.message` field, or else we will display the generic 'unidentified' message. This is a safe assumption for `VisibleGraphQLError`s, which use this field name; for all other error classes we may use, they should make sure to conform to this specification. ### Events (Mixpanel) For events, we send a string value (`message`) to Mixpanel. This is `JSON.stringify(x)` for unidentified errors. For recognised errors, it's a fixed string describing that error: e.g. "SSO email already exists" for the classic signed-in-with-passworded-account error. All of this section applies equally both to errors originating from the client and to those originating from the server.