/// Reports a hint for the user about how the error could be fixed.
Reports a hint for the user about how the error could be fixed.
Reports a hint for the user about how the error could be fixed .
pub fn hint(&self) -> Option<String> {
        match self {
            CoordError::AutomaticTimestampFailure {..} => {
                Some("\n- Use `SELECT ... AS OF` to manually choose a timestamp for your query.
                - Create indexes on the listed unmaterialized sources or on the views derived from those sources".into())
            }
            CoordError::Catalog(c) => c.hint(),
            CoordError::ConstrainedParameter {
                valid_values: Some(valid_values),
                ..
            } => Some(format!("Available values: {}.", valid_values.join(", "))),
            CoordError::Eval(e) => e.hint(),
            CoordError::UnknownLoginRole(_) => {
                // TODO(benesch): this will be a bad hint when people are used
                // to creating roles in Materialize, since they might drop the
                // default "materialize" role. Remove it in a few months
                // (say, April 2021) when folks are more used to using roles
                // with Materialize. (We don't want to do something more clever
                // and include the actual roles that exist in the message,
                // because that leaks information to unauthenticated clients.)
                Some("Try connecting as the \"materialize\" user.".into())
            }
            CoordError::InvalidRematerialization { source_type, .. } => {
                let doc_page = match source_type {
                    RematerializedSourceType::Postgres => "postgres",
                    RematerializedSourceType::S3 => "text-s3",
                };
                Some(format!(
                    "See the documentation at https://materialize.com/docs/sql/create-source/{}",
                    doc_page
                ))
            }
            CoordError::InvalidClusterReplicaAz { expected, az: _ } => {
                Some(if expected.is_empty() {
                    "No availability zones configured; do not specify AVAILABILITY ZONE".into()
                } else {
                    format!("Valid availability zones are: {}", expected.join(", "))
                })
            }
            CoordError::InvalidClusterReplicaSize { expected, size: _ } => Some(format!(
                "Valid cluster replica sizes are: {}",
                expected.join(", ")
            )),
            CoordError::NoClusterReplicasAvailable(_) => {
                Some("You can create cluster replicas using CREATE CLUSTER REPLICA".into())
            }
            CoordError::UntargetedLogRead { .. } => Some(
                "Use `SET cluster_replica = <replica-name>` to target a specific replica in the \
                 active cluster. Note that subsequent `SELECT` queries will only be answered by \
                 the selected replica, which might reduce availability. To undo the replica \
                 selection, use `RESET cluster_replica`.".into()),
            _ => None,
        }
    }
pub fn hint ( & self ) -> Option < String > { match self { CoordError :: AutomaticTimestampFailure { .. } => { Some ( " \n " . into ( ) ) } CoordError :: Catalog ( c ) => c . hint ( ) , CoordError :: ConstrainedParameter { valid_values : Some ( valid_values ) , .. } => Some ( format ! ( " " valid_values join ( " " ) ) ) , CoordError :: Eval ( e ) => e . hint ( ) , CoordError :: UnknownLoginRole ( _ ) => { // TODO(benesch): this will be a bad hint when people are used // to creating roles in Materialize, since they might drop the // default "materialize" role. Remove it in a few months // (say, April 2021) when folks are more used to using roles // with Materialize. (We don't want to do something more clever // and include the actual roles that exist in the message, // because that leaks information to unauthenticated clients.) Some ( " \" \" " . into ( ) ) } CoordError :: InvalidRematerialization { source_type , .. } => { let doc_page = match source_type { RematerializedSourceType :: Postgres => " " , RematerializedSourceType :: S3 => " " , } ; Some ( format ! ( " " doc_page ) ) } CoordError :: InvalidClusterReplicaAz { expected , az : _ } => { Some ( if expected . is_empty ( ) { " " . into ( ) } else { format ! ( " " expected join ( " " ) ) } ) } CoordError :: InvalidClusterReplicaSize { expected , size : _ } => Some ( format ! ( " " expected join ( " " ) ) ) , CoordError :: NoClusterReplicasAvailable ( _ ) => { Some ( " " . into ( ) ) } CoordError :: UntargetedLogRead { .. } => Some ( " \
 \
 \
 " . into ( ) ) , _ => None , } }
Reports a hint for the user about how the error could be fixed.
Reports a hint for the user about how the error could be fixed .
&self