Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove user-management error cases from scenario-service proto. #12460

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remove Error.UserManagement
  • Loading branch information
nickchapman-da committed Jan 18, 2022
commit aac12a1d76214f805358b75f7e46bb03aa8a3478
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ final class Conversions(

case Error.PartyAlreadyExists(party) =>
builder.setScenarioPartyAlreadyExists(party)

case Error.UserManagement(err) =>
builder.setCrash(s"UserManagement error unhandled in scenario service: $err")
}
builder.build
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ object Error {
/** Tried to allocate a party that already exists. */
final case class PartyAlreadyExists(name: String) extends Error

final case class UserManagement(error: UserManagementError) extends Error

sealed abstract class UserManagementError extends Product with Serializable

object UserManagementError {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ private[lf] object Pretty {

case Error.PartyAlreadyExists(party) =>
text(s"Error: Tried to allocate a party that already exists: $party")

case Error.UserManagement(err) => prettyError(err)
}

def prettyError(err: Error.UserManagementError) = err match {
case Error.UserManagementError.UserNotFound(userId) =>
text(s"Error: User with id $userId does not exist")
case Error.UserManagementError.UserExists(userId) =>
text(s"Error: Tried to create a user id $userId but such a user already exists")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class IdeLedgerClient(
private val userManagementStore = new ide.UserManagementStore()

private def handleUserManagement[T](r: ide.UserManagementStore.Result[T]): Future[T] =
r.fold(err => Future.failed(scenario.Error.UserManagement(err)), Future.successful(_))
r.fold(err => sys.error(s"handleUserManagement, unexpected: $err"), Future.successful(_))

override def query(parties: OneAnd[Set, Ref.Party], templateId: Identifier)(implicit
ec: ExecutionContext,
Expand Down