generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
Labels
papercutSmall annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a feature requestSmall annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a feature request
Description
Describe the improvement you'd like to request
Some of our Diagnostic implementations set the labels function without setting source_code. These two fields are related (see the excerpt from miette below), so it doesn't make sense to set one without the other. The relevant error types seem to print fine (for some reason), but users who are consuming the miette errors programmatically may observe unexpected behavior. For example: I was trying to update this testing code to use the error's source text instead of the passed in source (which may or may not match the error), but found that the source text didn't exist for ToCSTErrors.
/// Source code to apply this `Diagnostic`'s [`Diagnostic::labels`] to.
fn source_code(&self) -> Option<&dyn SourceCode> {
None
}
/// Labels to apply to this `Diagnostic`'s [`Diagnostic::source_code`]
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>> {
None
}Here's the list of error types doing this, from a quick scan through the code:
UnexpectedSlotErrorToCSTErrorhuman_schema_errors::ParseErrorToJsonSchemaErrorschema_warnings::ShadowsBuiltinWarningschema_warnings::ShadowsEntityWarning
Describe alternatives you've considered
No response
Additional context
No response
Is this something that you'd be interested in working on?
- 👋 I may be able to implement this internal improvement
-
⚠️ This feature might incur a breaking change
Metadata
Metadata
Assignees
Labels
papercutSmall annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a feature requestSmall annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a feature request