allisonwang-db commented on a change in pull request #33530:
URL: https://github.com/apache/spark/pull/33530#discussion_r678580293



##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {

Review comment:
       unrecognizedBlockIdError

##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {
+    new UnrecognizedBlockId(name)
+  }
+
+  def taskHasNotLockedBlockError(currentTaskAttemptId: Long, blockId: 
BlockId): Throwable = {
+    new SparkException(s"Task $currentTaskAttemptId has not locked block 
$blockId for writing")
+  }
+
+  def blockDoesNotExistError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId does not exist")
+  }
+
+  def cannotSaveBlockOnDecommissionExecutorError(blockId: BlockId): Throwable 
= {

Review comment:
       cannotSaveBlockOnDecommissionedExecutorError

##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {
+    new UnrecognizedBlockId(name)
+  }
+
+  def taskHasNotLockedBlockError(currentTaskAttemptId: Long, blockId: 
BlockId): Throwable = {
+    new SparkException(s"Task $currentTaskAttemptId has not locked block 
$blockId for writing")
+  }
+
+  def blockDoesNotExistError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId does not exist")
+  }
+
+  def cannotSaveBlockOnDecommissionExecutorError(blockId: BlockId): Throwable 
= {
+    new SparkException(s"Block $blockId cannot be saved on decommissioned 
executor")
+  }
+
+  def waitingForReplicationFinishError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for replication to 
finish", t)
+  }
+
+  def unableRegisterWithExternalShuffleServerError(t : scala.Throwable): 
Throwable = {
+    new SparkException(s"Unable to register with external shuffle server due 
to : ${t.getMessage}",
+      t)
+  }
+
+  def waitingForAsyncReregistrationError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for async. 
reregistration", t)
+  }
+
+  def unexpectedShuffleBlockWithUnsupportedResolverError(
+      shuffleManager: ShuffleManager,
+      blockId: BlockId): Throwable = {
+    new SparkException(s"Unexpected shuffle block ${blockId} with unsupported 
shuffle " +
+      s"resolver ${shuffleManager.shuffleBlockResolver}")
+  }
+
+  def failedStoreBlockOnBlockManagerError(
+      blockManagerId: BlockManagerId,
+      blockId: BlockId): Throwable = {
+    new SparkException(s"Failure while trying to store block $blockId on 
$blockManagerId.")
+  }
+
+  def readLockedBlockNotFoundError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId was not found even though it's 
read-locked")
+  }
+
+  def failedBlockGetEvenHeldALockError(blockId: BlockId): Throwable = {
+    new SparkException(s"get() failed for block $blockId even though we held a 
lock")
+  }
+
+  def blockNotFoundError(blockId: BlockId): Throwable = {
+    new BlockNotFoundException(blockId.toString)
+  }
+
+  def interruptedError(): Throwable = {
+    new InterruptedException()
+  }
+
+  def blockStatusQueryReturnedNullError(blockId: BlockId): Throwable = {
+    new SparkException(s"BlockManager returned null for BlockStatus query: 
$blockId")
+  }
+
+  def unexpectedResultBlockManagerMasterEndpointError(): Throwable = {
+    new SparkException("BlockManagerMasterEndpoint returned false, expected 
true.")
+  }
+
+  def failedCreateDirectoryError(path: String, maxAttempts: Int): Throwable = {

Review comment:
       failToCreateDirectoryError

##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {
+    new UnrecognizedBlockId(name)
+  }
+
+  def taskHasNotLockedBlockError(currentTaskAttemptId: Long, blockId: 
BlockId): Throwable = {
+    new SparkException(s"Task $currentTaskAttemptId has not locked block 
$blockId for writing")
+  }
+
+  def blockDoesNotExistError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId does not exist")
+  }
+
+  def cannotSaveBlockOnDecommissionExecutorError(blockId: BlockId): Throwable 
= {
+    new SparkException(s"Block $blockId cannot be saved on decommissioned 
executor")
+  }
+
+  def waitingForReplicationFinishError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for replication to 
finish", t)
+  }
+
+  def unableRegisterWithExternalShuffleServerError(t : scala.Throwable): 
Throwable = {
+    new SparkException(s"Unable to register with external shuffle server due 
to : ${t.getMessage}",
+      t)
+  }
+
+  def waitingForAsyncReregistrationError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for async. 
reregistration", t)
+  }
+
+  def unexpectedShuffleBlockWithUnsupportedResolverError(
+      shuffleManager: ShuffleManager,
+      blockId: BlockId): Throwable = {
+    new SparkException(s"Unexpected shuffle block ${blockId} with unsupported 
shuffle " +
+      s"resolver ${shuffleManager.shuffleBlockResolver}")
+  }
+
+  def failedStoreBlockOnBlockManagerError(
+      blockManagerId: BlockManagerId,
+      blockId: BlockId): Throwable = {
+    new SparkException(s"Failure while trying to store block $blockId on 
$blockManagerId.")
+  }
+
+  def readLockedBlockNotFoundError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId was not found even though it's 
read-locked")
+  }
+
+  def failedBlockGetEvenHeldALockError(blockId: BlockId): Throwable = {
+    new SparkException(s"get() failed for block $blockId even though we held a 
lock")
+  }
+
+  def blockNotFoundError(blockId: BlockId): Throwable = {
+    new BlockNotFoundException(blockId.toString)
+  }
+
+  def interruptedError(): Throwable = {
+    new InterruptedException()
+  }
+
+  def blockStatusQueryReturnedNullError(blockId: BlockId): Throwable = {
+    new SparkException(s"BlockManager returned null for BlockStatus query: 
$blockId")
+  }
+
+  def unexpectedResultBlockManagerMasterEndpointError(): Throwable = {

Review comment:
       unexpectedBlockManagerMasterEndpointResultError

##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {
+    new UnrecognizedBlockId(name)
+  }
+
+  def taskHasNotLockedBlockError(currentTaskAttemptId: Long, blockId: 
BlockId): Throwable = {
+    new SparkException(s"Task $currentTaskAttemptId has not locked block 
$blockId for writing")
+  }
+
+  def blockDoesNotExistError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId does not exist")
+  }
+
+  def cannotSaveBlockOnDecommissionExecutorError(blockId: BlockId): Throwable 
= {
+    new SparkException(s"Block $blockId cannot be saved on decommissioned 
executor")
+  }
+
+  def waitingForReplicationFinishError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for replication to 
finish", t)
+  }
+
+  def unableRegisterWithExternalShuffleServerError(t : scala.Throwable): 
Throwable = {
+    new SparkException(s"Unable to register with external shuffle server due 
to : ${t.getMessage}",
+      t)
+  }
+
+  def waitingForAsyncReregistrationError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for async. 
reregistration", t)
+  }
+
+  def unexpectedShuffleBlockWithUnsupportedResolverError(
+      shuffleManager: ShuffleManager,
+      blockId: BlockId): Throwable = {
+    new SparkException(s"Unexpected shuffle block ${blockId} with unsupported 
shuffle " +
+      s"resolver ${shuffleManager.shuffleBlockResolver}")
+  }
+
+  def failedStoreBlockOnBlockManagerError(
+      blockManagerId: BlockManagerId,
+      blockId: BlockId): Throwable = {
+    new SparkException(s"Failure while trying to store block $blockId on 
$blockManagerId.")
+  }
+
+  def readLockedBlockNotFoundError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId was not found even though it's 
read-locked")
+  }
+
+  def failedBlockGetEvenHeldALockError(blockId: BlockId): Throwable = {

Review comment:
       failToGetBlockWithLockError

##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {
+    new UnrecognizedBlockId(name)
+  }
+
+  def taskHasNotLockedBlockError(currentTaskAttemptId: Long, blockId: 
BlockId): Throwable = {
+    new SparkException(s"Task $currentTaskAttemptId has not locked block 
$blockId for writing")
+  }
+
+  def blockDoesNotExistError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId does not exist")
+  }
+
+  def cannotSaveBlockOnDecommissionExecutorError(blockId: BlockId): Throwable 
= {
+    new SparkException(s"Block $blockId cannot be saved on decommissioned 
executor")
+  }
+
+  def waitingForReplicationFinishError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for replication to 
finish", t)
+  }
+
+  def unableRegisterWithExternalShuffleServerError(t : scala.Throwable): 
Throwable = {

Review comment:
       unableToRegisterWithExternalShuffleServerError

##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {
+    new UnrecognizedBlockId(name)
+  }
+
+  def taskHasNotLockedBlockError(currentTaskAttemptId: Long, blockId: 
BlockId): Throwable = {
+    new SparkException(s"Task $currentTaskAttemptId has not locked block 
$blockId for writing")
+  }
+
+  def blockDoesNotExistError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId does not exist")
+  }
+
+  def cannotSaveBlockOnDecommissionExecutorError(blockId: BlockId): Throwable 
= {
+    new SparkException(s"Block $blockId cannot be saved on decommissioned 
executor")
+  }
+
+  def waitingForReplicationFinishError(t : scala.Throwable): Throwable = {

Review comment:
       `waitingForReplicationToFinishError(e: Throwable)`
   nit: remove the white space after `t`

##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {
+    new UnrecognizedBlockId(name)
+  }
+
+  def taskHasNotLockedBlockError(currentTaskAttemptId: Long, blockId: 
BlockId): Throwable = {
+    new SparkException(s"Task $currentTaskAttemptId has not locked block 
$blockId for writing")
+  }
+
+  def blockDoesNotExistError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId does not exist")
+  }
+
+  def cannotSaveBlockOnDecommissionExecutorError(blockId: BlockId): Throwable 
= {
+    new SparkException(s"Block $blockId cannot be saved on decommissioned 
executor")
+  }
+
+  def waitingForReplicationFinishError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for replication to 
finish", t)
+  }
+
+  def unableRegisterWithExternalShuffleServerError(t : scala.Throwable): 
Throwable = {
+    new SparkException(s"Unable to register with external shuffle server due 
to : ${t.getMessage}",
+      t)
+  }
+
+  def waitingForAsyncReregistrationError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for async. 
reregistration", t)
+  }
+
+  def unexpectedShuffleBlockWithUnsupportedResolverError(
+      shuffleManager: ShuffleManager,
+      blockId: BlockId): Throwable = {
+    new SparkException(s"Unexpected shuffle block ${blockId} with unsupported 
shuffle " +
+      s"resolver ${shuffleManager.shuffleBlockResolver}")
+  }
+
+  def failedStoreBlockOnBlockManagerError(
+      blockManagerId: BlockManagerId,
+      blockId: BlockId): Throwable = {
+    new SparkException(s"Failure while trying to store block $blockId on 
$blockManagerId.")
+  }
+
+  def readLockedBlockNotFoundError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId was not found even though it's 
read-locked")
+  }
+
+  def failedBlockGetEvenHeldALockError(blockId: BlockId): Throwable = {
+    new SparkException(s"get() failed for block $blockId even though we held a 
lock")
+  }
+
+  def blockNotFoundError(blockId: BlockId): Throwable = {
+    new BlockNotFoundException(blockId.toString)
+  }
+
+  def interruptedError(): Throwable = {
+    new InterruptedException()
+  }
+
+  def blockStatusQueryReturnedNullError(blockId: BlockId): Throwable = {
+    new SparkException(s"BlockManager returned null for BlockStatus query: 
$blockId")
+  }
+
+  def unexpectedResultBlockManagerMasterEndpointError(): Throwable = {
+    new SparkException("BlockManagerMasterEndpoint returned false, expected 
true.")
+  }
+
+  def failedCreateDirectoryError(path: String, maxAttempts: Int): Throwable = {
+    new IOException(
+      s"Failed to create directory ${path} with permission 770 after 
$maxAttempts attempts!")
+  }
+
+  def unsupportedOperationError(): Throwable = {
+    new UnsupportedOperationException()
+  }
+
+  def noSuchElementError(): Throwable = {
+    new NoSuchElementException()
+  }
+
+  def fetchFailedError(
+      bmAddress: BlockManagerId,
+      shuffleId: Int,
+      mapId: Long,
+      mapIndex: Int,
+      reduceId: Int,
+      message: String,
+      cause: Throwable = null): Throwable = {
+    new FetchFailedException(bmAddress, shuffleId, mapId, mapIndex, reduceId, 
message, cause)
+  }
+
+  def failedGetNonShuffleBlockError(blockId: BlockId, e: Throwable): Throwable 
= {

Review comment:
       failToGetNonShuffleBlockError

##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {
+    new UnrecognizedBlockId(name)
+  }
+
+  def taskHasNotLockedBlockError(currentTaskAttemptId: Long, blockId: 
BlockId): Throwable = {
+    new SparkException(s"Task $currentTaskAttemptId has not locked block 
$blockId for writing")
+  }
+
+  def blockDoesNotExistError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId does not exist")
+  }
+
+  def cannotSaveBlockOnDecommissionExecutorError(blockId: BlockId): Throwable 
= {
+    new SparkException(s"Block $blockId cannot be saved on decommissioned 
executor")
+  }
+
+  def waitingForReplicationFinishError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for replication to 
finish", t)
+  }
+
+  def unableRegisterWithExternalShuffleServerError(t : scala.Throwable): 
Throwable = {
+    new SparkException(s"Unable to register with external shuffle server due 
to : ${t.getMessage}",
+      t)
+  }
+
+  def waitingForAsyncReregistrationError(t : scala.Throwable): Throwable = {

Review comment:
       nit: extra white space

##########
File path: core/src/main/scala/org/apache/spark/errors/SparkCoreErrors.scala
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.errors
+
+import java.io.IOException
+
+import org.apache.spark.SparkException
+import org.apache.spark.shuffle.{FetchFailedException, ShuffleManager}
+import org.apache.spark.storage.{BlockId, BlockManagerId, 
BlockNotFoundException, UnrecognizedBlockId}
+
+object SparkCoreErrors {
+  def failedParseBlockIdError(name: String): Throwable = {
+    new UnrecognizedBlockId(name)
+  }
+
+  def taskHasNotLockedBlockError(currentTaskAttemptId: Long, blockId: 
BlockId): Throwable = {
+    new SparkException(s"Task $currentTaskAttemptId has not locked block 
$blockId for writing")
+  }
+
+  def blockDoesNotExistError(blockId: BlockId): Throwable = {
+    new SparkException(s"Block $blockId does not exist")
+  }
+
+  def cannotSaveBlockOnDecommissionExecutorError(blockId: BlockId): Throwable 
= {
+    new SparkException(s"Block $blockId cannot be saved on decommissioned 
executor")
+  }
+
+  def waitingForReplicationFinishError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for replication to 
finish", t)
+  }
+
+  def unableRegisterWithExternalShuffleServerError(t : scala.Throwable): 
Throwable = {
+    new SparkException(s"Unable to register with external shuffle server due 
to : ${t.getMessage}",
+      t)
+  }
+
+  def waitingForAsyncReregistrationError(t : scala.Throwable): Throwable = {
+    new SparkException("Error occurred while waiting for async. 
reregistration", t)
+  }
+
+  def unexpectedShuffleBlockWithUnsupportedResolverError(
+      shuffleManager: ShuffleManager,
+      blockId: BlockId): Throwable = {
+    new SparkException(s"Unexpected shuffle block ${blockId} with unsupported 
shuffle " +
+      s"resolver ${shuffleManager.shuffleBlockResolver}")
+  }
+
+  def failedStoreBlockOnBlockManagerError(

Review comment:
       failToStoreBlockOnBlockManagerError




-- 
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]

Reply via email to