DamianPendrak commented on code in PR #34674: URL: https://github.com/apache/superset/pull/34674#discussion_r2309938001
########## superset/custom_database_errors.py: ########## @@ -0,0 +1,49 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import re +from typing import Any + +from superset.errors import SupersetErrorType + +# CUSTOM_DATABASE_ERRORS: Configure custom error messages for database exceptions. +# Transform raw database errors into user-friendly messages with optional documentation +# links using custom_doc_links. Set show_issue_info=False to hide default error codes. +# Example: +# CUSTOM_DATABASE_ERRORS = { +# "trino": { +# re.compile(r'message="(?P<message>[^"]*)"'): ( Review Comment: Right, that's probably too advanced example. I added a simpler one that matches with a part of the error message "permission denied for view". The regex is also used in the custom errors in the database engine files, so it keeps the same approach ########## superset-frontend/src/components/ErrorMessage/CustomDocLink.tsx: ########## @@ -0,0 +1,35 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { useTheme } from '@superset-ui/core'; +import { Icons } from '@superset-ui/core/components'; + +export type CustomDocLinkProps = { + url: string; + label: string; +}; + +export const CustomDocLink = ({ url, label }: CustomDocLinkProps) => { + const theme = useTheme(); + return ( + <a href={url} target="_blank" rel="noopener noreferrer"> + {label} <Icons.Full iconSize="m" iconColor={theme.colorPrimary} /> Review Comment: Fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
