-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ledger-configuration: Return a structured error from checkTime. [KVL-…
…1002] (#10373) * ledger-configuration: More rigorous tests for LedgerTimeModel. Let's actually check the return values, not just the constructor. * ledger-configuration: Create a type that represents time out of range. Only used in testing for now. * ledger-configuration: Return a structured error from `checkTime`. CHANGELOG_BEGIN CHANGELOG_END * ledger-configuration: We like braces. Co-authored-by: Miklos <[email protected]> Co-authored-by: Miklos <[email protected]>
- Loading branch information
1 parent
66284c1
commit 37ff1a6
Showing
6 changed files
with
130 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
ledger/sandbox-classic/src/main/scala/platform/sandbox/stores/ledger/TimeModelError.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.daml.platform.sandbox.stores.ledger | ||
|
||
import com.daml.ledger.configuration.LedgerTimeModel | ||
|
||
private sealed trait TimeModelError { | ||
def message: String | ||
} | ||
|
||
private object TimeModelError { | ||
object NoLedgerConfiguration extends TimeModelError { | ||
val message: String = | ||
"No ledger configuration available, cannot validate ledger time" | ||
} | ||
|
||
final case class InvalidLedgerTime(outOfRange: LedgerTimeModel.OutOfRange) | ||
extends TimeModelError { | ||
lazy val message: String = | ||
outOfRange.message | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters