Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ object DashboardResource {
val q3 = ProjectSearchQueryBuilder.constructQuery(uid, params, includePublic)
val q4 = DatasetSearchQueryBuilder.constructQuery(uid, params, includePublic)
q1.unionAll(q3).unionAll(q4)
case _ => throw new IllegalArgumentException(s"Unknown resource type: ${params.resourceType}")
case _ => throw new BadRequestException(s"Unknown resource type: ${params.resourceType}")
}

val finalQuery =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.apache.texera.web.resource.dashboard.DashboardResource.SearchQueryPar
import org.jooq.impl.{DSL => JDSL}
import org.jooq.{OrderField, SQLDialect}

import javax.ws.rs.BadRequestException
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

Expand Down Expand Up @@ -128,7 +129,7 @@ class DashboardResourceSpec extends AnyFlatSpec with Matchers {
// constructQuery / SqlServer, so this is reachable with no database. The
// exception *type* is the real assertion: if the guard were moved below the
// query construction, this would surface as a SqlServer failure instead.
val thrown = the[IllegalArgumentException] thrownBy DashboardResource.searchAllResources(
val thrown = the[BadRequestException] thrownBy DashboardResource.searchAllResources(
new SessionUser(new User()), // uid stays null; unused on this path
SearchQueryParams(resourceType = "notAResourceType")
)
Expand All @@ -138,7 +139,7 @@ class DashboardResourceSpec extends AnyFlatSpec with Matchers {
it should "reject a resourceType that only differs from a valid one by case" in {
// Guards against someone relaxing the match to be case-insensitive on one
// side only: "Workflow" is not "workflow" today.
val thrown = the[IllegalArgumentException] thrownBy DashboardResource.searchAllResources(
val thrown = the[BadRequestException] thrownBy DashboardResource.searchAllResources(
new SessionUser(new User()),
SearchQueryParams(resourceType = "Workflow")
)
Expand Down
Loading