Skip to content

Commit 14832d0

Browse files
committed
Apply review changes: add final to selected exception classes
1 parent 015975b commit 14832d0

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

auth/.js/src/main/scala/io/udash/auth/AuthApplication.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import io.udash._
44

55
object AuthApplication {
66
implicit final class ApplicationAuthExt[HierarchyRoot >: Null <: GState[HierarchyRoot]](
7-
val application: Application[HierarchyRoot]
7+
private val application: Application[HierarchyRoot]
88
) extends AnyVal {
99
/**
1010
* Adds the default listener of authorization failure in routing (redirects to provided state).
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
package io.udash.auth
22

3-
import com.avsystem.commons.serialization.HasGenCodec
3+
class UnauthenticatedException extends RuntimeException(s"User has to be authenticated to access this content.")
44

5-
import scala.annotation.nowarn
6-
7-
@nowarn("msg=Case classes should be marked as final")
8-
case class UnauthenticatedException() extends RuntimeException(s"User has to be authenticated to access this content.")
9-
object UnauthenticatedException extends HasGenCodec[UnauthenticatedException]
10-
11-
@nowarn("msg=Case classes should be marked as final")
12-
case class UnauthorizedException() extends RuntimeException(s"Provided user context does not have access to this content.")
13-
object UnauthorizedException extends HasGenCodec[UnauthorizedException]
5+
class UnauthorizedException extends RuntimeException(s"Provided user context does not have access to this content.")

rest/src/main/scala/io/udash/rest/raw/RestRequest.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import com.avsystem.commons.meta.*
66
import com.avsystem.commons.misc.{AbstractValueEnum, AbstractValueEnumCompanion, EnumCtx}
77
import com.avsystem.commons.rpc.*
88

9-
import scala.annotation.nowarn
109
import scala.util.control.NoStackTrace
1110

1211
/**
@@ -24,14 +23,14 @@ final case class RestParameters(
2423
@multi @tagged[Path] path: List[PlainValue] = Nil,
2524
@multi @tagged[Header] @allowOptional headers: IMapping[PlainValue] = IMapping.empty,
2625
@multi @tagged[Query] @allowOptional query: Mapping[PlainValue] = Mapping.empty,
27-
@multi @tagged[Cookie] @allowOptional cookies: Mapping[PlainValue] = Mapping.empty
26+
@multi @tagged[Cookie] @allowOptional cookies: Mapping[PlainValue] = Mapping.empty,
2827
) {
2928
def append(method: RestMethodMetadata[_], otherParameters: RestParameters): RestParameters =
3029
RestParameters(
3130
path ::: method.applyPathParams(otherParameters.path),
3231
headers ++ otherParameters.headers,
3332
query ++ otherParameters.query,
34-
cookies ++ otherParameters.cookies
33+
cookies ++ otherParameters.cookies,
3534
)
3635

3736
def path(values: String*): RestParameters =
@@ -50,8 +49,7 @@ object RestParameters {
5049
final val Empty = RestParameters()
5150
}
5251

53-
@nowarn("msg=Case classes should be marked as final")
54-
case class HttpErrorException(code: Int, payload: HttpBody = HttpBody.Empty, cause: Throwable = null)
52+
final case class HttpErrorException(code: Int, payload: HttpBody = HttpBody.Empty, cause: Throwable = null)
5553
extends RuntimeException(s"HTTP ERROR $code${payload.textualContentOpt.fold("")(p => s": $p")}", cause) with NoStackTrace {
5654
def toResponse: RestResponse = RestResponse(code, IMapping.empty, payload)
5755
}

rpc/.js/src/main/scala/io/udash/rpc/internals/UsesServerRPC.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import io.udash.rpc.*
55
import io.udash.utils.{CallbacksHandler, Registration}
66
import org.scalajs.dom
77

8-
import scala.annotation.nowarn
98
import scala.concurrent.duration.{Duration, DurationInt}
109
import scala.concurrent.{Future, Promise}
1110
import scala.scalajs.js
@@ -97,6 +96,5 @@ private[rpc] trait UsesServerRPC[ServerRPCType] extends UsesRemoteRPC[ServerRPCT
9796
}
9897

9998
object UsesServerRPC {
100-
@nowarn("msg=Case classes should be marked as final")
101-
case class CallTimeout(callTimeout: Duration) extends RuntimeException(s"Response missing after $callTimeout.")
99+
final case class CallTimeout(callTimeout: Duration) extends RuntimeException(s"Response missing after $callTimeout.")
102100
}

0 commit comments

Comments
 (0)