zero323 commented on a change in pull request #31238: URL: https://github.com/apache/spark/pull/31238#discussion_r576751923
########## File path: python/pyspark/exceptions.py ########## @@ -0,0 +1,42 @@ +# +# 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. +# + +class NonDriverReferenceError(Exception): + """ + Thrown when trying to reference a driver's value or attribute in a non driver environment. + """ + + +class JavaGatewayError(Exception): + """ + Indicates an error of the java gateway. + """ + + +class SparkContextInitializationError(RuntimeError): Review comment: Just my two cents ‒ while adding more specific exception classes can be useful, especially in contexts where we might expect user to recover, there is little point in building hierarchy for types of conditions which are effectively a programming mistake. For example `NonDriverReferenceError` refers to condition, from which there is no meaningful way out. Such cases should rather provide human readable description of the problem, so user can easily identify and fix the issue (@HyukjinKwon and others already did a lot of work in that direction). Similarly `JavaGatewayErrors` are typically fatal and there is little that user can do there, without tinkering with internals. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
