Skip to content

Make ShellError more readable by consistently using named fields #10700

@sholderbach

Description

@sholderbach

Our ShellError still has a number of variants that are tuple structs (i.e. unnamed list of types to provide). Especially if there are multiple fields of the same type it is unclear at the creation side of a ShellError which field goes where. This is exacerbated by the fact that for the miette diagnostics we have sometimes format strings that make strong assumptions what should be provided for a particular field.

Thus we should convert each of them to named struct variants (i.e. Identifier { field: type, ... }). While doing so it is worth checking if we use the fields of the error correctly. Sometimes we might need to change incompatible uses of a variant to a different variant.

Variants that need named fields

  • UnsupportedInput
  • DatetimeParseError
  • NetworkFailure
  • CommandNotFound
  • AliasNotFound
    - FlagNotFound
  • FileNotFound
  • FileNotFoundCustom
  • PluginFailedToLoad
  • PluginFailedToEncode
  • PluginFailedToDecode
  • IOInterrupted
  • IOError
  • IOErrorSpanned
  • PermissionDeniedError
  • OutOfMemoryError
  • NotADirectory
  • DirectoryNotFound
  • DirectoryNotFoundCustom
  • MoveNotPossibleSingle
  • CreateNotPossible
  • ChangeAccessTimeNotPossible
  • ChangeModifiedTimeNotPossible
  • RemoveNotPossible
  • NoFileToBeRemoved
  • NoFileToBeMoved
  • NoFileToBeCopied
  • ReadingFile
  • DidYouMean
  • DidYouMeanCustom
  • NonUtf8
  • NonUtf8Custom
  • DowncastNotPossible
  • UnsupportedConfigValue
  • MissingConfigValue
  • NeedsPositiveValue
  • GenericError
  • OutsideSpannedLabeledError
  • RemovedCommand
  • UnexpectedAbbrComponent
  • EvalBlockWithInput
  • Break
  • Continue
  • Return
  • NotAConstant
  • NotAConstCommand
  • NotAConstHelp

Example PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-unhelpfulThe error message you observe is not helpful to identify the problemcategory:meta-issueAn issue that tracks other issueshelp wantedstatus: Extra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions