forked from smithy-lang/smithy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from skmcgrail/rules-refactors
Rules refactors
- Loading branch information
Showing
92 changed files
with
1,306 additions
and
1,188 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
83 changes: 0 additions & 83 deletions
83
...-engine/src/main/java/software/amazon/smithy/rulesengine/language/SourceAwareBuilder.java
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
...rc/main/java/software/amazon/smithy/rulesengine/language/error/InvalidRulesException.java
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,48 @@ | ||
/* | ||
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.smithy.rulesengine.language.error; | ||
|
||
import software.amazon.smithy.model.FromSourceLocation; | ||
import software.amazon.smithy.model.SourceLocation; | ||
import software.amazon.smithy.rulesengine.language.util.SourceLocationHelpers; | ||
import software.amazon.smithy.utils.SmithyUnstableApi; | ||
|
||
/** | ||
* Exception thrown when the ruleset is invalid. | ||
*/ | ||
@SmithyUnstableApi | ||
public final class InvalidRulesException extends RuntimeException implements FromSourceLocation { | ||
private final transient SourceLocation sourceLocation; | ||
|
||
public InvalidRulesException(String message, FromSourceLocation location) { | ||
super(createMessage(message, location.getSourceLocation())); | ||
sourceLocation = location.getSourceLocation(); | ||
} | ||
|
||
@Override | ||
public SourceLocation getSourceLocation() { | ||
return sourceLocation; | ||
} | ||
|
||
private static String createMessage(String message, SourceLocation sourceLocation) { | ||
if (sourceLocation == SourceLocation.NONE) { | ||
return message; | ||
} else { | ||
String prettyLocation = SourceLocationHelpers.stackTraceForm(sourceLocation); | ||
return message.contains(prettyLocation) ? message : message + " (" + prettyLocation + ")"; | ||
} | ||
} | ||
} |
23 changes: 0 additions & 23 deletions
23
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/language/eval/Eval.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.