Skip to content

[Bug]: Add guard/null checks in HandleBars helpers & extensions #45

@samatstariongroup

Description

@samatstariongroup

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of the EcoreNetto
  • I have searched open and closed issues to ensure it has not already been reported

Description

  • Summary: Several helpers cast/index without guards, so bad inputs throw NullReferenceException/IndexOutOfRangeException instead of a meaningful HandlebarsException; one error message is also inaccurate.
  • Affected files: ECoreNetto.HandleBars/StringHelper.cs:47,59 (cast-then-use without null check), ECoreNetto.HandleBars/GeneralizationHelper.cs:71 (ESuperTypes[0] after an Any() check), ECoreNetto.HandleBars/StructuralFeatureHelper.cs:148 (message says "two arguments" but checks for one), ECoreNetto.Extensions/StringExtensions.cs:50 (words[0] without empty check)
  • Proposed solution: Add explicit argument/null/empty validation with descriptive messages; fix the inaccurate "two arguments" message to match the actual check.
  • Acceptance criteria:
    • Helpers throw descriptive HandlebarsException/ArgumentException on invalid input rather than low-level exceptions.
    • The argument-count error message matches the validation.
    • Tests cover the invalid-input paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions