Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
performance optimization: avoid stack trace collection for Recoverabl…
Browse files Browse the repository at this point in the history
…eModifierError
  • Loading branch information
aslesarenko committed Oct 9, 2020
1 parent 1086cef commit 03fbc66
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/scala/scorex/core/validation/ModifierError.scala
@@ -1,5 +1,7 @@
package scorex.core.validation

import scala.util.control.NoStackTrace

/** Base trait for errors that were occurred during NodeView Modifier validation
*/
trait ModifierError {
Expand All @@ -22,11 +24,12 @@ class MalformedModifierError(val message: String, cause: Option[Throwable] = Non
def toThrowable: Throwable = this
}

/** Temporary modifier error that may be recovered in future after some history updates
/** Temporary modifier error that may be recovered in future after some history updates.
* When an instance is created, the stack trace is not collected which makes this exception lightweight.
*/
@SuppressWarnings(Array("org.wartremover.warts.Null"))
class RecoverableModifierError(val message: String, cause: Option[Throwable] = None)
extends Exception(message, cause.orNull) with ModifierError {
extends Exception(message, cause.orNull) with ModifierError with NoStackTrace {
def isFatal: Boolean = false
def toThrowable: Throwable = this
}
Expand Down

0 comments on commit 03fbc66

Please sign in to comment.